Just call theDialog.dismiss() from onDestroy().

On Thu, Dec 17, 2009 at 3:27 PM, Mark Wyszomierski <[email protected]> wrote:
> Hi,
>
> There are lots of code samples on third party sites where an alert
> dialog is built and shown like this:
>
>    new AlertDialog.Builder(context).setMessage("Test.").show();
>
> If the dialog is left open when the phone rotates, it seems to leak:
>
> 12-17 18:23:47.543: ERROR/WindowManager(2440): Activity
> com.test.ActivityMain has leaked window
> com.android.internal.policy.impl.phonewindow$decorv...@43775a28 that
> was originally added here
> 12-17 18:23:47.543: ERROR/WindowManager(2440):
> android.view.WindowLeaked: Activity com.test.ActivityMain has leaked
> window com.android.internal.policy.impl.phonewindow$decorv...@43775a28
> that was originally added here
> 12-17 18:23:47.543: ERROR/WindowManager(2440):     at
> android.view.ViewRoot.<init>(ViewRoot.java:214)
> .... etc ...
>
> We can use the showDialog() methods, but the above does come in handy
> sometimes. Is there a proper way to clean up dialogs created in this
> manner?
>
> Thanks
>
> --
> 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
>



-- 
Romain Guy
Android framework engineer
[email protected]

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