Android 12 Developer Preview is here! Try it out, and give us your feedback!

Lesson 7: Activity and fragment lifecycles

Learn about Activity and Fragment lifecycles, how to handle complex lifecycle situations, and use logging to help debug and track the state of the app.

 

Lifecycles and logging

Codelab

Import the starter code for the DessertClicker app. Then, add basic logging to explore the lifecycle methods. Next, you explore lifecycle use cases and the fragment lifecycle.

Complex lifecycle situations

Codelab

Modify the DessertClicker app to use the Jetpack lifecycle library. Use the Android Debug Bridge to simulate your app's process shutdown. Then, retain and restore app data that may be lost if the app is unexpectedly closed.

Quiz

Earn your badge for completing Lesson 7: Activity and fragment lifecycles.