On Wed, Apr 27, 2011 at 4:22 PM, Eric <e...@alum.mit.edu> wrote:
> You then navigate to a new activity by starting it.

Which triggers onPause() and onStop() on the original activity.

 Your
> activity gets paused.  Android can 'finish' your activity at this
> point, WITHOUT killing the process.

Which triggers onDestroy() on the original activity.

> In
> that case, the thread you started in onStart will still be running.

Only if developer did not stop the thread in onPause(), onStop(), or
onDestroy().

> I think it makes much more sense for the documentation to clarify
> this, and recommend that people do all auxiliary setup/cleanup in
> onResume/onPause, and nowhere else.

You are welcome to think what you want. And, as I noted, it's not a
bad idea to tend towards onPause() and onStop(). However, there is
nothing directly wrong with waiting until onDestroy() to shut down a
background thread, and there may be perfectly valid reasons for
keeping that thread around as long as possible (e.g., chat client
maintaining a socket connection to a chat server).

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

_Android Programming Tutorials_ Version 3.3 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