Sunday, July 3, 2016

Android Crash View not attached to window manager

java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:191)
at android.view.Window$LocalWindowManager.updateViewLayout(Window.java:428)
at android.app.Dialog.onWindowAttributesChanged(Dialog.java:596)
at android.view.Window.setDefaultWindowFormat(Window.java:1013)

This looks to be because dismissing say a dialog which is not attached to Window yet. 

Below was the solution 

if(dialog != null && dialog.isShowing())
{
dialog.dismiss();
}

references:

No comments:

Post a Comment