Reputation: 34560
I have a Dialog with a Spinner. This is a managed dialog (ie I use showDailog(DIALOG_ID)
to show it).
If I click on the Spinner there are 2 dialogs now - the main dialog and the Spinner popup. After screen orientation it crashes. I can see 2 exceptions in LogCat, the first is WindowLeaked and the second IlleagalArgumentException: View not attached to window manager.
I guess this is a bug in Android, but is there a way to workaround this?
Upvotes: 4
Views: 895
Reputation: 22603
Also struggled with this and wrote down my experiences regarding progress dialogs and orientation changes on this blog post.
Required a lot of code plumbing to do it right (the official Android way to handle config and orientation changes), or a simple attribute on the activity in the manifest as a "workaround" without code changes.
Upvotes: 2