Yes, usually AsyncTask is only able to be run once. Restarting the same task
may give you a little trouble though due to this. If you have something that
needs to run over and over again I would suggest that you look into starting
a service and loop the task you need to keep running in its own thread and
just make it sleep for the needed amount of time. As long as you have the
activity running in its own thread in a service you can loop it and make it
repeat infinitely as long as you allow the service to run.

On Thu, Aug 18, 2011 at 8:30 AM, Streets Of Boston
<[email protected]>wrote:

> You mean you do NOT want to execute the same task twice (e.g. when the user
> clicks a button two or more times in quick succession)?
>
> If so, then disable the button until the AsyncTask has finished.
> You know when it's finished by implementing/overriding the onPostExecute
> method and from there you can enable that button again.
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to