Skip to content Skip to sidebar Skip to footer

Android Dialogs Are Causing Android.view.windowmanager$badtokenexception: Unable To Add Window

I have putted my activities in childview and now I cannot display dialogs from my activities and adapters. In my logCat i'm getting 04-11 12:39:59.823: E/AndroidRuntime(12831): FA

Solution 1:

I also faced the same problem. I have used tab bar for this. Just use getParent() instead of youractivity.this.

I hope this will help.

Solution 2:

the activity object must be the activity that is currently shown on the screen. If it's something that was already paused or not build show yet it will give this error.

Solution 3:

see here the answer for ActivityGroup.

For child activity of a ActivityGroup, we cannot be sure that it always exist and live when we use the Context in the child activity such as PrompDialog. For example:

mPromptDialog = newLoginPromptDialog(this);//this is used as Context//But when we use this context it may be destroyed.//So this is the parent instance
mPromptDialog = newLoginPromptDialog(this.getParent());

preference: http://www.cnblogs.com/kaima/archive/2011/08/04/2127813.html

Post a Comment for "Android Dialogs Are Causing Android.view.windowmanager$badtokenexception: Unable To Add Window"