[android-developers] Re: Dialog Survival Over Configuration Change

2009-04-27 Thread Nmix
My workaround is in the message you quoted. I don't see how overriding onPrepareDialog can work since it isn't called after the config change -- that's the essence of the bug. On Apr 27, 9:02 am, AusR wrote: > I see bug 1639 - is there a workaround to restore a 're-created'dialogusing > code i

[android-developers] Re: Dialog Survival Over Configuration Change

2009-04-27 Thread AusR
I see bug 1639 - is there a workaround to restore a 're-created' dialog using code in an overridden onPrepareDialog? On Mar 6, 6:13 am, Romain Guy wrote: > >> It is a problem. In my, and others', opinion it is a *bug* that the > >> onPrepareDialog is not called when adialogis restored on a > >>c

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-05 Thread Romain Guy
>> It is a problem. In my, and others', opinion it is a *bug* that the >> onPrepareDialog is not called when a dialog is restored on a >> configuration change. onCreateDialog is called when appropriate, but >> onPrepareDialog is not It is a bug indeed. >> >> I think the onPrepareDialog shoul

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-05 Thread Nmix
I'm leaning towards agreeing with you, but it may be a toss up between being a bug or obscure documentation, or that I'm just not understanding the situation well enough. If it is a bug, it may be more fundamental than onPrepareDialog() since it doesn't seem as if the old dialog is reachable after

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-05 Thread Streets Of Boston
Good to hear you got it working. It is a problem. In my, and others', opinion it is a *bug* that the onPrepareDialog is not called when a dialog is restored on a configuration change. onCreateDialog is called when appropriate, but onPrepareDialog is not I think the onPrepareDialog should ALW

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-05 Thread Nmix
On Mar 4, 11:59 pm, Nmix wrote: > No doubt you're right. After a while it feels like I'm doing a > peculiar dance to celebrate the Rites of Spring, all the while > sprinkling magic pixie dust over my code. > > I had already come to the same conclusion, that doing dismissDialog() > in onSaveInstan

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Nmix
No doubt you're right. After a while it feels like I'm doing a peculiar dance to celebrate the Rites of Spring, all the while sprinkling magic pixie dust over my code. I had already come to the same conclusion, that doing dismissDialog() in onSaveInstanceState() is a mistake, because it changes a

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Dianne Hackborn
I think you are getting yourself into a more and more tangled mess. As a fairly broad rule, you shouldn't be doing any state-changing behavior in onSaveInstanceState() -- this is not for the system to tell you about something interesting happening, but for it to get your current state at whatever

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Nmix
It's even worse than what you're speaking of, now that I've been doing more testing. onSaveInstanceState() is called for activity pauses (like an incoming call) and also for configuration changes. However it now matters which occurred, it seems, when it comes time to recover. If it was a pause,

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Streets Of Boston
Made a copy-paste error. The 'dirty' workaround in the onResume() should read: if (mPrepareDialog) { onPrepareDialog(R.layout.mydialogid, mDialog); } On Mar 4, 5:33 pm, Streets Of Boston wrote: > I had a similar issue. There seems to be an issue with onPrepareDialog

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Streets Of Boston
I had a similar issue. There seems to be an issue with onPrepareDialog after a configuration change. In my app i'm using managed dialogs as well. the onCreateDialog creates it and the onPrepareDialog makes sure that the dynamic content is shown correctly. However, when a configuration change hap

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Romain Guy
Sorry I got confused, you want removeDialog(), not dismissDialog(). The latter only closes the dialog but it is still known as a managed dialog. removeDialog() on the other hand tells the Activity to forget about the dialog *and* to dismiss it. On Wed, Mar 4, 2009 at 10:53 AM, Nmix wrote: > > Ju

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Nmix
Just to finish this off, here is what I've learned now that I have it working properly. First, dismissDialog() in onDestroy() does not dismiss the dialog. I have to do it in onSaveInstanceState(). If I do it in onDestroy() and I try to recreate it in onCreate() with showDialog() -- after recrea

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Nmix
On Mar 4, 12:21 pm, Marco Nelissen wrote: > On Wed, Mar 4, 2009 at 9:13 AM, Nmix wrote: > > > 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

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Marco Nelissen
On Wed, Mar 4, 2009 at 9:13 AM, Nmix wrote: > > 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

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Nmix
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

[android-developers] Re: Dialog Survival Over Configuration Change

2009-03-04 Thread Romain Guy
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