Ugh. I already use onCreateDialog() and onPrepareDialog() since that
is how I deal with making the content dynamic.  I figured dismissing
it (ok, I agree that's not quite a best practice), would be simplest,
especially since in the context of the app it is very unlikely that
the user would change config while it is showing.

I'll try dismissing in onDestroy().  I hadn't done that since I wasn't
sure that it'd be called on a config change.

It also seems from your comment that onCreateDialog() and
onPrepareDialog() do get called again sometime after onCreate().  If
true, I hadn't realized that.  I may look into that later and see if I
can refresh those dialogs.

Thanks.

On Mar 4, 11:42 am, Romain Guy <romain...@google.com> wrote:
> If you want to call dismissDialog(int) you need to use managed
> dialogs. You will need to look at the javadoc for showDialog(int),
> onCreateDialog() and onPrepareDialog(). The API Demos also show how to
> use managed dialogs.
>
> If you are already using these APIs, onCreate() is not the right
> placae to dismiss the dialog since it doesn't exist yet. You would
> have to do this in onDestroy() for instance. Note that dismissing the
> dialog on configuration change goes against the purpose of managed
> dialogs :)
>
>
>
> On Wed, Mar 4, 2009 at 8:37 AM, Nmix <nepean...@gmail.com> wrote:
>
> > Flipping between landscape and portrait is causing me a problem with
> > dialogs that are active at the time of config change.  The dialogs
> > survive (which I think is good), but I have the problem that some of
> > my dialogs contain dynamic content which would need to be refreshed in
> > the dialog views.  All that content disappears from the dialog views
> > after the config change.
>
> > I thought it would be easier to do a dismissDialog() on restoration in
> > onCreate(), letting the user press the button that shows the dialog.
> > I successfully save and recover the dialog id, but when I attempt to
> > dismissDialog(id) I get an IllegalArgumentException: no dialog with id
> > 1 was ever shown via Activity$showDialog.
>
> > Ok, so that doesn't work, and I still have that messed up dialog up on
> > the screen that I want to get rid of.  How can I do that?  Are there
> > any other reasonable alternatives?  Thanks.
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
--~--~---------~--~----~------------~-------~--~----~
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