Activities & Lifecycle
Learn what an Activity is, understand the Activity lifecycle callbacks (onCreate, onStart, onResume, onPause, onStop, onDestroy), and use ViewBinding.
What Is an Activity?
An Activity is a single screen in your Android app.
- Every screen (login, home, settings) is an Activity
- It manages a layout (XML) and user interactions
- Declared in AndroidManifest.xml
Think of it as the Android equivalent of a web page — each page is an Activity.
Activity Lifecycle
An Activity goes through a series of lifecycle states as the user navigates the app:
- Created → Started → Resumed (visible & active)
- Paused (partially hidden)
- Stopped (completely hidden)
- Destroyed (Activity is gone)
You override lifecycle methods to respond to these transitions.