Closed ghost closed 8 years ago
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);
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