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?
✗ Incorrect
The
onCreate method is the first lifecycle method called when an activity is created.What happens in the
onPause method?✗ Incorrect
onPause is called when the activity is partially obscured but still visible.Which lifecycle method should you use to release resources when the activity is no longer visible?
✗ Incorrect
onStop is called when the activity is no longer visible, so it is a good place to release resources.If the user presses the back button, which lifecycle method is called before the activity is destroyed?
✗ Incorrect
onDestroy is called before the activity is destroyed after the back button is pressed.Which method is called when the activity returns to the foreground after being paused?
✗ Incorrect
onResume is called when the activity comes back to the foreground and is ready for user interaction.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.