Overview - Activity lifecycle methods (onCreate, onStart, onResume, onPause, onStop, onDestroy)
What is it?
Activity lifecycle methods are special functions in Android apps that tell you what state your screen (activity) is in. They help you manage what happens when your app starts, becomes visible, goes to the background, or closes. Each method like onCreate, onStart, onResume, onPause, onStop, and onDestroy is called automatically by the system at different times. This helps your app behave smoothly and use resources wisely.
Why it matters
Without these lifecycle methods, your app wouldn't know when to prepare its screen, save data, or pause tasks. Imagine if your app kept running heavy tasks even when hidden, or lost user data when switching screens. These methods solve that by giving clear moments to start, pause, or clean up work. This makes apps faster, saves battery, and avoids crashes.
Where it fits
Before learning lifecycle methods, you should understand what an Activity is in Android and basic Kotlin syntax. After mastering lifecycle methods, you can learn about saving app state, handling configuration changes, and advanced topics like ViewModel and LiveData for better app design.