On 07/03/2011 02:12 PM, William Ferguson wrote:
> I have an Activity with several managed dialogs. After some of them
> have displayed (and dismissed) I rotate the device.
> 
> #onCreateDialog is called for each previously displayed dialog 
> regardless of whether they currently being displayed or not.
> Strange, but relatively harmless as code in #onCreateDialog deals
> with static construction pieces.
> 
> But I also see #onPrepareDialog being called for every previously 
> displayed dialog too. And that is a worry, because #onPrepareDialog
> is where you inject state sensitive data into the dialog. State that
> may no longer be relevant or even wholesome at a point other than
> when the dialog should be displayed.
> 
> Any idea why #onPrepareDialog is being unnecessarily called? This is
> is 2.3.3

I guess it's because Activity#dismissDialog does not remove the dialog
from the list of managed dialogs. Use Activity#removeDialog to do that

from Activity#removeDialog source:

"Removes any internal references to a dialog managed by this Activity.
If the dialog is showing, it will dismiss it as part of the clean up.
This can be useful if you know that you will never show a dialog again
and want to avoid the overhead of saving and restoring it in the future."

Kind regards,

Martijn Brinkers

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to