Look at the java docs for Timer and TimerTask. The TimerTask can cancel the AsyncTask or else the AsyncTask can cancel the timer, whichever finishes first. Either way, you never run longer than the Timer time.
On Sep 20, 6:21 am, Neilz <[email protected]> wrote: > Hi all. > > I'm running a network service within an ASyncTask. I want to be able > to time the task, and after a certain period of time interrupt it. > > Is there a simple way to do this? Basically, when the doInBackground() > methods starts, I want to say "If it hasn't completed in 30 seconds, > do something else". > > Thanks. -- 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

