Thursday, September 8, 2011

Re: [android-developers] Dialog dismiss()

On Thu, Sep 8, 2011 at 4:30 PM, Greg Donald <gdonald@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 Activity also will not be null as long as the thread spawned from within it is still running, since the thread itself holds an implicit reference to it (TheThreadsActivity.this).

Geez..  I'm thinking I might just lock it in to landscape mode and forgo the grief.

That will just hide the problem - rotating the device is the easiest but not only way to get in this situation. Better to deal with it and fix it correctly. 

On Thu, Sep 8, 2011 at 4:41 PM, Miguel Morales <therevoltingx@gmail.com> wrote:
The problem is that you are attempting to update the UI in a foreign thread.
This line: progressDialog.dismiss();

It just queues the dialog up for cleanup - or something along those lines. This is why Greg's code path is not in the stacktrace.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

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

No comments:

Post a Comment