0
0
Android Kotlinmobile~5 mins

Activity lifecycle methods (onCreate, onStart, onResume, onPause, onStop, onDestroy) in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the onCreate method in an Android Activity?
The onCreate method is called when the activity is first created. It is used to initialize the activity, set up the user interface, and prepare any data needed for the activity.
Click to reveal answer
beginner
Which lifecycle method is called when the activity becomes visible to the user but is not yet interactive?
The onStart method is called when the activity becomes visible but is not yet in the foreground for user interaction.
Click to reveal answer
intermediate
Explain the difference between onPause and onStop methods.
onPause is called when the activity is partially obscured but still visible (like a dialog on top). onStop is called when the activity is no longer visible to the user.
Click to reveal answer
intermediate
When is onDestroy called in the activity lifecycle?
onDestroy is called before the activity is destroyed, either because the activity is finishing or the system is temporarily destroying it to save space.
Click to reveal answer
beginner
What lifecycle method is called when the activity starts interacting with the user?
onResume is called when the activity is in the foreground and ready for the user to interact with.
Click to reveal answer
Which method is called first when an activity is launched?
AonPause
BonStart
ConResume
DonCreate
What happens in the onPause method?
AActivity is no longer visible
BActivity is fully visible and interactive
CActivity is partially obscured but still visible
DActivity is destroyed
Which lifecycle method should you use to release resources when the activity is no longer visible?
AonStop
BonStart
ConResume
DonCreate
If the user presses the back button, which lifecycle method is called before the activity is destroyed?
AonDestroy
BonStop
ConPause
DonStart
Which method is called when the activity returns to the foreground after being paused?
AonStart
BonResume
ConCreate
DonStop
Describe the sequence of lifecycle methods called from launching an activity to it being fully interactive.
Think about the steps from creation to user interaction.
You got /4 concepts.
    Explain what happens in the lifecycle when the user switches to another app and then returns.
    Consider what happens when the activity is hidden and then shown again.
    You got /5 concepts.