Re: [android-developers] Dialog dismiss()

2011-09-14 Thread Emanuel Moecklin
I ran into these issues too and the only solution I found so far that works in any case (rotation, home button restart activity, sliding out keyboard, killing an app etc.) is using an AsyncTask. I'm not a big fan of AsyncTasks normally but to show and dismiss a ProgressDialog this seems to be

Re: [android-developers] Dialog dismiss()

2011-09-14 Thread Streets Of Boston
I found the use of activities (with a Theme.Dialog or such theme) much easier and prefer it over the use of dialogs. And usually, i put busy-indicators such as indeterminate progress-bars on the screen it self (the right top corner of the screen or as a 'full' screen overlay). This prevents me

Re: [android-developers] Dialog dismiss()

2011-09-13 Thread Greg Donald
On Friday, September 9, 2011 10:44:24 PM UTC-5, TreKing wrote: At this point I'm going with setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ); It's a sure thing. It's not Yup, it's not. I have crash logs (many of them, and for multiple resolutions) with

Re: [android-developers] Dialog dismiss()

2011-09-13 Thread Miguel Morales
It really isn't that hard. I went ahead and created a test project to show the way I'm doing it. I'll probably write a blog post about it. See: https://github.com/therevoltingx/android_orientation_test/blob/master/src/com/solrpg/orientation_test/DefaultActivity.java On Tue, Sep 13, 2011 at 9:50

Re: [android-developers] Dialog dismiss()

2011-09-09 Thread Greg Donald
On Thu, Sep 8, 2011 at 2:29 PM, TreKing treking...@gmail.com wrote: Or use showDialog() / dismissDialog(). I tried this and it's actually worse now. It crashes everytime I rotate, not just occasionally like before. My pattern looks like this now: private static final int DIALOG_GAMES = 0;

Re: [android-developers] Dialog dismiss()

2011-09-09 Thread TreKing
On Fri, Sep 9, 2011 at 8:24 PM, Greg Donald gdon...@gmail.com wrote: Also tried it without the dismissDialog() call in onDestroy(). The exceptional condition is: 09-09 20:05:12.626: ERROR/AndroidRuntime(3831): Caused by: java.lang.IllegalArgumentException: no dialog with id 0 was ever shown

[android-developers] Dialog dismiss()

2011-09-08 Thread Greg Donald
I keep getting this crash report from my users: java.lang.IllegalArgumentException: View not attached to window manager at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355) at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200) at

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread TreKing
On Thu, Sep 8, 2011 at 2:14 PM, Greg Donald gdon...@gmail.com wrote: How can I keep my dismiss() calls from blowing up? Keep a class-level reference to the dialog and dismiss it if you're being destroyed. Or use showDialog() / dismissDialog(). The issue (I ran into this): 1 - You show your

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread Greg Donald
On Thu, Sep 8, 2011 at 2:29 PM, TreKing treking...@gmail.com wrote: On Thu, Sep 8, 2011 at 2:14 PM, Greg Donald gdon...@gmail.com wrote: How can I keep my dismiss() calls from blowing up? Keep a class-level reference to the dialog and dismiss it if you're being destroyed. Well, I just have

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread Miguel Morales
The problem is that you are attempting to update the UI in a foreign thread. This line: progressDialog.dismiss(); You seem to be using a handler, so just change it to: handler.postRunnable(new Runnable() { @Override public void run() { progressDialog.dismiss(); }); Don't ever

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread Miguel Morales
Actually, don't use a ProgressDialog, use Activity.showDialog() instead. This handles device orientation. On Thu, Sep 8, 2011 at 2:41 PM, Miguel Morales therevolti...@gmail.com wrote: The problem is that you are attempting to update the UI in a foreign thread. This line:

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread TreKing
On Thu, Sep 8, 2011 at 4:30 PM, Greg Donald gdon...@gmail.com wrote: I don't get why if( this != null ) evaluates to true when the stack trace seems to imply the Activity is gone already. Be careful - in you code *this* refers to the thread itself, *not* the Activity. In any case, the parent

Re: [android-developers] Dialog dismiss()

2011-09-08 Thread Miguel Morales
dismiss() can be called from any thread: http://developer.android.com/reference/android/app/Dialog.html#dismiss() It just queues the dialog up for cleanup - or something along those lines. Hmm, I see. I would argue it shouldn't be thread safe, since it violates the don't touch the UI rule.