Life cycle of Android Activity after pressing Back button
Suppose there is an activity A, from which you launch activity B. If, while in activity B, you hit the back button, you are popping activity B off the stack and B will not be in the activity stack any longer.
Whenever you push an activity to the stack, onCreate
is called, and if you press back button, onDestroy
is called, which means that the activity is flushed away.
Please visit my blog for further information:http://upadhyayjiteshandroid.blogspot.in/2013/02/android-lifecycle.html
please visit for more
http://developer.android.com/guide/components/tasks-and-back-stack.html
http://developer.android.com/training/basics/activity-lifecycle/starting.html
The following activity call back methods are called, after pressing back button.
onPause()onStop()onDestroy()
The activity is destroyed.
And it recreates when launched again. These are the callback methods when it launches again.
onCreate()onStart()onResume()
I know the answer is been accepcted, still if this helps someone I am putting it.
When app is opening for the first time, by clicking the Icon
onCreate()onStart()onResume()
When home button is pressed
onPause()onStop()
when app is again opened by clicking the app icon or launched from recent
onRestart()onStart()onResume()
when app is opened and then back button is pressed
onPause()onStop()onDestroy()