Gracefully destroying Dialog box

by Neilz » Fri, 23 Oct 2009 20:11:55 GMT

Sponsored Links
 Hi. I have an activity which pops up a Dialog box, to get some text
input from the user. The problem arises when you switch orientation.
The Dialog disappears, so I have added code to set and check flags in
the savedInstanceState, meaning that the Dialog is displayed again in
these circumstances.

However, the dialog isn't being closed gracefully when the orientation
is switched. I get the following error:

10-23 12:53:54.385: ERROR/WindowManager(2852): Activity
com.bla.bla.Bla has leaked window$decorv...@435ceda0 that
was originally added here
10-23 12:53:54.385: ERROR/WindowManager(2852):
android.view.WindowLeaked: Activity com.bla.bla.Bla has leaked window$decorv...@435ceda0 that
was originally added here

I know when the window is going to be closed, but can't find a way of
closing it manually. I open it with;  ...but there
doesn't seem to be any corresponding alert.destroy() method or

Any ideas how I can manually close the dialog box without user input?

Gracefully destroying Dialog box

by Neilz » Sat, 24 Oct 2009 16:46:35 GMT

 Oh well. Maybe I should raise it as a bug, as this is a problem to me,
and it seems there should be a standard method to the effect of


Sponsored Links

Gracefully destroying Dialog box

by Lance Nanek » Sat, 24 Oct 2009 17:13:00 GMT

 You can close a dialog using its dismiss() method : #dismiss%28%29

You might want to consider having the activity manage restoring your
dialog for you as well: #onCreateDialog%28int%29


Other Threads

1. Email ContentProvider

hi ,

I could see Email ContentProvider in Email application( under packages/
apps/Email/src/com/android/email/provider). Why was it not exported in
SDK or am I blind?. If this is not exported, was there any way I could
read Email from other apps?. Thanks.



2. Mapview + Tab example


i need to have an mapview on a tab.
The attached example (
file.html) shows how to do this if using intents.
Now i want to change the zoom level of the mapview(s).
How can i do this, although i'm using intents (or is there completely
different solution)?


3. Reliable GPS location

4. Problem with song's ID3 Genre tag. If tag isn't present can't ID Song..

5. Mail stays in my Outbox - Using Exchange ActiveSync

6. Best free hollywood moives downloads. Over 50 beautiful sketches ...

7. How to Calculate Temperature