Open petrnohejl opened 11 years ago
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
Did you declare it in AndroidMainfest.xml?
Yes, I did. On Jelly Bean, it works fine.
Get this on Android 2.3 works fine on Honeycomb and up.
For few users on Gingerbread I have this error too...
Any new idea of the reason?
It can have something in common with Spinner in Action Bar. Do You have any in Your Action Bar?
I don't.
Please add a test case to the known-bugs project on the dev branch.
I've started to see reports of this after a recent update that has Fragments in a ViewPager that provide action items with sub menus. I'll see if I can actually reproduce it myself in an emulator (something which is usually a pain for these sorts of bugs) and extract out a small enough example.
I get similar stack trace when screen orientation changes and there are Fragments in ViewPager and those Fragments contains submenus in ActionBar. I have open question with sample repo on StackOverflow: http://stackoverflow.com/q/13473165/262462
I just met exactly this bug in code. It was caused by inflating Menu in Activity and accessing (searching for MenuItems) it in Fragment. It's probably caused because in some situations (eg. screen rotation) is Fragment re-created faster than Activity and after such event it was accessing Menu not yet inflated.
I have problem with action bar menu button when I press it on Android 2.2 (emulator). It sometimes crashes with this exception:
This is the source code:
Menu layout:
Any idea why this is happening? Thanks.