Almost every Android interview has a lifecycle question, and almost every production crash report has a lifecycle bug somewhere in it. The callbacks themselves are easy to memorize. What trips people up is knowing which callback to use for which job, and what happens when the system kills your process while the user is away.
This guide covers the Activity and Fragment lifecycle the way it shows up in real apps: rotation, process death, back stack, view binding leaks and collecting flows safely. It ends with interview questions and answers.
The Activity lifecycle in one table
Callback Called when Use it for
onCreate() Activity is first created Inflate UI, set up ViewModel, restore saved state
onStart() Activity becomes visible Start things that should run while visible
onResume() Activity is in the foreground and interactive Camera, sensors, anything exclusive
onPause() Another activity is taking focus Release exclusive resources, keep it fast
onStop() Activity is no longer visible Stop updates, save…