Dialog with a Spinner + orientation change
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 t开发者_JS百科his is a bug in Android, but is there a way to workaround this?
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.
精彩评论