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
com.android.internal.policy.impl.phonewindow$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
com.android.internal.policy.impl.phonewindow$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 alert.show();  ...but there
doesn't seem to be any corresponding alert.destroy() method or
similar.

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
alert.close();



--~--~---------~--~----~------------~-------~--~----~


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 :
 http://developer.android.com/intl/fr/reference/android/app/Dialog.html #dismiss%28%29

You might want to consider having the activity manage restoring your
dialog for you as well:
 http://developer.android.com/intl/fr/reference/android/app/Activity.html #onCreateDialog%28int%29




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. startActivity from a Fragment doesn

startActivity from a fragment starts the Activity and then returns
immediately.  It executes the onCreate in the new Activity but never
brings it to the front.

Has anyone seen this behavior?

-- 

2. Android apps soon to be runnable on RIM's Blackberrys

Just thought I would let everyone know  about this press release.


http://press.rim.com/release.jsp?id=4935


Think of the new user base *drools*

I would not be surprised if in the long term we start to see Blackberrys
running skinned android...

-- 

3. Merged contacts problem

4. Removing/Blocking keys from virtual keyboard possible?

5. Small Size Activity Layout as compare to Original Device size

6. Bud setAdapter of AbsListView

7. After upgrading to Android 11 I get java.lang.NoSuchMethodError: android.widget.AbsListView.setAdapter