Created
July 21, 2011 04:09
-
-
Save grantland/1096474 to your computer and use it in GitHub Desktop.
Android Activity Lifecycle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] = starting state | |
States: | |
not running (dead) | |
onResume (running) | |
onStop (minimized) | |
onPause (screen off) | |
Launch Application: | |
[not running|onStop] (onCreate|onRestart) -> onStart -> onResume | |
Press Back: | |
If activity stack is empty: | |
[onResume] onPause -> onStop -> onDestroy | |
If activity stack is not empty: | |
[B.onResume] B.onPause -> B.onStop -> B.onDestroy | |
-> A.(onRestart|onCreate) -> A.onStart -> A.onResume | |
Press Home: | |
[onResume] onPause -> onStop | |
Turn Off Screen: | |
[onResume] onPause | |
Turn On Screen: | |
[onPause] onResume | |
Calling startActivity: | |
-> B.onCreate -> B.onStart -> B.onResume | |
[A.onResume] A.onPause -> A.onStop | |
Rotating | |
[onResume] onPause -> onStop -> onDestroy -> onCreate -> onStart -> onResume | |
onStart -> onStop | |
Open activity (onStart -> onResume) and open a dialog above it (onPause). | |
Press home (onStop) and reopen (onStart). | |
Press home (onStop) | |
Freeing more memory: | |
[onPause] not running | |
[onStop] not running | |
[onDestroy] not running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment