Android & Jetpack Compose (50 Qs)•Part 1: Architecture, Jetpack Compose & Core Components (1 - 10)
What is the Activity Lifecycle in Android and what are its core callback states?
senior LevelCode ExampleComponentsLifecycleDocker & Containers
In Simple Words: An Activity represents a single focused screen that the user can interact with. Its lifecycle transitions through 6 core callbacks:
onCreate(): Activity is initialized; setup UI views, data bindings, and ViewModel observers.onStart(): Activity becomes visible to the user, but not yet interactive.onResume(): Activity enters the foreground; interactive and receiving user input.onPause(): Activity partially obscured (e.g. permission dialog, multi-window mode) or about to enter background; pause animations or video playback.onStop(): Activity is no longer visible to the user.onDestroy(): Final cleanup before the activity is destroyed by the system orfinish()is called.
text
Activity Lifecycle State Flow:
[onCreate] ──► [onStart] ──► [onResume] (Interactive in Foreground)
│
[onPause] (Partially Obscured)
│
[onStop] (Hidden in Background)
│
[onDestroy] (Deallocated from RAM)