Skip to content

Instantly share code, notes, and snippets.

Last active March 29, 2019 13:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Understanding Android Lifecycle
  • onCreate -> Builds UI. Activity is created.

  • onStart -> Activity is visible.

  • onResume -> Becomes active foreground app.

In reverse:

  • onPause -> Activity has lost focus(for example, if it's partially obscured: a dialog pops up or whatever).

  • onStop -> No longer visible(completely obscured, moved to the background).

  • onDestroy -> Activity is destroyed, indicating the end of activity lifecycle.

And, plus, if we hit home and relaunch the app(not destroying it; without being recreated) we get extra state, onRestart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment