> If by "kills the service" you mean "destroys the service", then no, I'm> reasonably certain the threads are not killed. The AsyncTask will run toOK, now I'm worried. I see a possible runaway task here with no way to
> completion regardless of the status of the component that started is.
> Leastways, I'm rather sure this is what happens with activities, and I'm
> not aware of any differences with respect to services in this regard.
> AsyncTask maintains a thread pool, so even when the task is complete,
> the thread does not necessarily terminate.
>
cancel.
I should of course call AsyncTask.cancel() in onDestroy()
But Ms. Hackborn has stated in previous threads that onDestroy() won't
necessarily be called when a service is destroyed.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
for (int i = 0; i < count; i++) {
if (isCancelled()) break;
doStuff(i);
}
In addition, the parameter passed to cancel can be used to interrupt
interruptible operations (I/O for instance.) I agree the documentation
should be clearer though.
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-d...@googlegroups.com
> To unsubscribe from this group, send email to
> android-develop...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Romain Guy
Android framework engineer
roma...@android.com