Android activity lifecycle: state order when new activity starts

Let Say Activity A is starting Activity B by Calling StartActivity(Intent) method then lifecycle call be like this :-

  • A onCreate()
  • A onStart()
  • A onResume()

Now Button click for startActivity(intent)

  • A onPause()

  • B onCreate()

  • B onStart()

  • B onResume()

  • A onStop()

..... If you press back button from Activity B then lifeCycle call will be .....

  • B onPause()

  • A onRestart()

  • A onStart()

  • A onResume()

  • B onStop()
  • B onDestory()

Now one more scenario "From Activity A start Activity B by calling StartActivity(Intent) on button click and use finish() method inside onstart() method on Activity B"

  • A onPause()

  • B onCreate()

  • B onStart()

  • A onResume()

  • B onStop()

  • B onDestory()


According to the documentation, the onStart on Activity2 is called before onStop on Activity1 (or, if you prefer, the os waits onStart on Activity2 to be finished before calling onStop on Activity1).

From http://developer.android.com/guide/topics/fundamentals/activities.html:

The order of lifecycle callbacks is well defined, particularly when the two activities are in the same process and one is starting the other. Here's the order of operations that occur when Activity A starts Acivity B:

Activity A's onPause() method executes. Activity B's onCreate(), onStart(), and onResume() methods execute in sequence. (Activity B now has user focus.) Then, if Activity A is no longer visible on screen, its onStop() method executes.


enter image description here

when I have checked it by programmatically its following all steps and easy to understand