app crash
opened this issue · comments
private void addViewToWindow(final BubbleBaseLayout view) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@OverRide
public void run() {
crashes here >>> getWindowManager().addView(view, view.getViewParams());
}
});
}
android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@ce82da -- permission denied for this window type
Solved with this:
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, 3);