Saturday, January 26, 2013

Re: [android-developers] AlertDialog and AsyncTask


I see a method isShowing()

but if the Dialog instance has been dismissed - won't that instance be gone

and therefore dialog.isShowing() would result in an error.

the problem i'm trying to make sure doesn't happen is the Asynctask
fnishing after the dialog closes and I try to write to a dialog control
that no longer exists.



On Saturday, January 26, 2013 8:25:24 PM UTC-5, TreKing wrote:

On Sat, Jan 26, 2013 at 4:04 PM, dashman <erjd...@gmail.com> wrote:
Is it possible byt the time the AlertDialog finishes that the
AlertDialog is closed - i.e. ui control no longer valid.

I assume you meant "by" and "the AsyncTask finishes" - yes, of course it's possible. You just have to dismiss the dialog faster than it takes the task to run.
 
Or will the AsyncTask close automatically if the AlertDialog is closed.

AsyncTask is not something that "closes". You can cancel it, if that's what you mean. But it doesn't do that automatically either. It does what you tell it to do. In this case, if your dialog goes away, you need to tell the task to stop doing what it's doing.

how can i tell if the AlertDialog is shown or no longer active.

Look at it's documentation. There are methods for being told when it is dismissed, canceled, or is currently showing.

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