On Mon, Dec 13, 2010 at 7:13 AM, umakantpatil <umakantpat...@gmail.com> wrote:
> I'm just confused about the lifecycle of activity and AsyncTask.
> I have an activity which opens new AsyncTask. Now if finish() that activity,
> will be background task also get closed ?

No.

> Or will it be still going ?

Yes.

> If going on then how long it will be going, till my code exceute or till the
> app gets exited ?

The background thread of the AsyncTask should keep running until
doInBackground() completes or the process is terminated.

However, this is not a good thing. If you need to have background
threads live even after an activity is finished, please have those
threads be managed by a Service (perhaps even an IntentService).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to