Saturday, November 2, 2013

[android-developers] Restoring instance state for a dialog that launches another dialog


I'm writing a DialogPreference subclass where the dialog can launch another dialog.  I've written the proper onSaveInstanceState/onRestoreInstanceState pairs for the custom View subclasses that are used in both dialogs.  So far, the second dialog is being restored, but it appears behind the first dialog. 

I looked at the source code for DialogPreference and figured out that in the showDialog method, it's calling the dialog's onRestoreInstanceState method before it shows the dialog.  So, I devised a workaround.  In my DialogPreference subclass, a Runnable variable is stored.  I overrode showDialog so that it first calls the superclass onShowDialog, and then calls the Runnable if it's not null.  The Runnable calls a method that may launch the second dialog if necessary.  However, using this workaround, the dialogs are still appearing in the wrong order.

Is there something about Dialogs that I do not know?  Is their order determined by when they're created, rather than when they're shown?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate