Mar 22, 2025
Lifecycle States:
onCreate function initializes variables and UI content.onStart makes the activity visible.onResume allows user interaction.onPause is called when another UI component comes to the foreground.onStop when the activity is no longer visible.onDestroy frees all resources.Lifecycle Diagram: Complex at first glance, but logical once understood.
onStop and onDestroy may not always be called.onPause for critical data saving as onStop/onDestroy might not be reliably called.