In my application, I display two dialogs. For each, I have a
getXXXDialogMessage() method which formulates the message (based on
the current state of the app) and returns a string. Then, in both
onCreateDialog and onPrepareDialog, I call
dialog.setMessage(getXXXDialogMessage()).

I'll have to check my logcat to see what happens if a rotate happens
while one of these dialogs is displayed, I haven't tested that yet.

Regards,
Jef

On Aug 5, 4:45 am, livinberlin <[email protected]> wrote:
> > If you only need to pass one number parameter, you could include it in
> > the ID.
>
> > protected Dialog onCreateDialog (int id) {
>
> > int realId = id & 0xffff;
> > int numFiles = id >> 16;
>
> > .....
>
> > }
>
> But this works only in the case of short numbers. I was hoping for a
> more general solution.
>
> > AlertDialog.Builder builder = new AlertDialog.Builder(this); // "this"
> > is Activity
> > builder.setMessage(....);
>
> > AlertDialog alert = builder.create();
> > alert.show();
>
> > without using onCreateDialog and friends.
>
> > Don't know if this is the right way to do it, but I haven't seen
> > anything in logcat about leaked windows.
>
> Using this technique, I always get a window leaked exception if the
> dialog is visible and I'm turning my device from landscape to portrait
> mode. The solution is to explicitly dismiss the dialog in onDestroy,
> but I dont't like that as you have to keep track of the currently open
> dialogs. My feeling is that android should do that for me.
>
> My current solution is to use a helper class which keeps track of the
> visible dialogs and dismisses them once the activity is destroyed.
> However, to me this solution seems far from perfect.
>
> Best regards,
> Andreas

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to