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