Let's say I have a Hello World single Activity application. I start this application.
What methods are invoked in each case:
What methods are invoked once the user starts the application again via the app icon (assuming the OS hasn't had a "other apps need memory condition"):
Thanks all.
Edit: Extra Credit: How can the user invoke onPause
without invoking onStop
?
both pressing home button and receiving a call don't remove the activity from the task's stack, and will be available when you re-enter the app => onPause() => onStop().
as the activity lifecycle diagram shows, re-entering the app calls => onRestart() => onStart() => onResume()
pressing the back button instead kills the activity => onPause() => onStop() => onDestroy()
re-entering the app in this case calls the classics => onCreate() => onStart() => onResume()
EDIT
from http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.