Last active
August 29, 2015 14:02
-
-
Save jwill/6e10a96fb5cfde9dd3a3 to your computer and use it in GitHub Desktop.
t
This file contains hidden or 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
[Shot A] A platform which terminates apps on its own is a pretty radical departure for anyone like me who cut their teeth on desktop Winforms development. | |
If you come from a similar background, you probably have a good idea of what you to expect in terms of lifecyle event handlers. | |
[draw] [Shot B] Our app has a main form - or Activity - [Shot A] that’s launched when the app is opened. | |
[draw build up] [Shot B] Then you listen for the onCreate callback to inflate your XML layout into the Activity’s UI and wire it up. At this point the Activity has been created. | |
[Shot A] It likely won’t be a surprise to you that there is a handler for when the Activity becomes visible. onStart, and another for when it has focus as the active foreground app, this one is onResume. | |
[draw teardown] [Shot B] And that the same is true in reverse, with onPause indicating the Activity has lost focus and should be paused, and onStop indicating that the app is no longer visible and should be stopped. | |
[Shot A] Finally, there’s an onDestroy method that’s fired [draw the next part] [Shot B] just before the Activity is destroyed. | |
[Shot A] When your app is first launched, you’ll quickly move through these states -- create, start, resume -- one after the other. But within the full application lifetime: from when onCreate is first called until the application is terminated -- your app will move through the active [indicate] and visible [indicate] lifecycles many times. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment