On Tue, Apr 20, 2010 at 4:10 PM, Nathan <[email protected]> wrote:

> > 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 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.
> >
> OK, now I'm worried. I see a possible runaway task here with no way to
> 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.
>

onDestroy() won't be called only in the case where your entirely process is
killed to free up memory.

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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