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. You will complete the DessertClicker app where a user "purchases" desserts by tapping on an image. Every time a dessert is clicked, the app updates the number of desserts purchased, and the total amount the user spent.

 

Lifecyles 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.

Managing 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.

Activity and Fragment lifecycles quiz

Test your knowledge and earn your Activity and Fragment lifecycles badge.