okay, this is officially driving me crazy.

I have an Activity and in onCreate() if some condition is true, I want
to pop up a dialog and inform the user.

public void onCreate() {
    ....
    ....
    if (condition is true)
        showDialog(42);
    ....
}

And I put in the appropriate code in onCreateDialog and
onPrepareDialog - no problem, everything is working fine.

The issue is if I change screen orientation, it destroys the activity
and re-creates it.  Fine.  But in doing that, it goes into onCreate
and calls showDialog(42) again, which causes onCreateDialog and
onPrepareDialog to be called again.  Then it seems like the underlying
system is trying to remember that I had a dialog up when i did the
screen orientation so it calls onCreateDialog and onPrepareDialog a
second time!  I can save an instance of the dialog id in
onSaveInstanceState() and restore it in onRestoreInstanceState(), but
it seems like onRestoreInstanceState() doesn't get called until
*after* onCreate is called, which means, it's going to make that call
to showDialog(42) again.  What's the best place to show dialogs after
an activity has come up such that screen orientation changes won't
cause multiple onCreateDialogs/onPrepareDialog calls to be made?

-- 
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