This is a great discussion.
This is probably the most important aspect of Android. It is critical
for all developers to properly understand activity lifecycle. From the
apps I've seen, most do not.
Google should also do a better job of clarifying and documenting this
lifecycle with additional examples and discussion.

On Jul 2, 2:35 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> On Fri, Jul 2, 2010 at 2:32 PM, Indicator Veritatis <mej1...@yahoo.com> wrote:
> > But what about when the user presses the home key? According to the
> > docs, onPause() is called WHENEVER the application goes invisible, not
> > just on the Back key, not just when another application is launched.
> > So no, it is not just on the Back key.
>
> onPause() is called whenever the activity loses the foreground from an
> input standpoint.
>
> onStop() is also called, if the activity is no longer visible on the screen.
>
> onDestroy() is also called, if the activity instance is going away for good.
>
> Hence, BACK calls onPause(), onStop(), and onDestroy(). HOME calls
> onPause() and onStop().

Not true. Back does not call onDestroy. On destroy is called when the
system decides the application is going away. This does not normally
occur on a back button or home button. Processes stay around until
memory is needed elsewhere. And even then, documentation states that
onDestroy may never get called even when the application is killed.

In general BACK doesn't do anything additional vs. HOME.

In general, I'd rely primarily on onPause since you're likely to get
this call. onStop may not even be called in extreme situations, but is
normally called.

>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to