Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An Android Activity moves through lifecycle callbacks as it becomes visible, interactive, obscured, stopped, recreated, or finished. The key sequence is onCreate(), onStart(), and onResume() as it enters use; then onPause() and onStop() as it loses focus and visibility. onDestroy() may end that instance, while onRestart() precedes the return of an Activity that was stopped. These callbacks describe transitions—not a promise that Android will keep the Activity or its process alive.

What is the Android Activity lifecycle?

An Activity is one app component that typically represents a screen. Android calls lifecycle methods to notify it about changes in its visibility and ability to interact with the user. Use those notifications to set up the screen, pause foreground-only behavior, and release resources at the appropriate time.

The callbacks are not a continuous record of everything that happens to the app. In particular, Android does not destroy an individual Activity as a way to reclaim memory: it may kill the app process, which removes its in-memory objects without giving every component a final callback. Android describes this distinction in its Activity lifecycle guide and process lifecycle documentation.

What happens at each lifecycle callback?

Callback When it runs Typical use
onCreate() When Android creates a new Activity instance. Set up the UI and initialize essential instance components. A saved-state bundle may be available for restoration.
onStart() When the Activity is becoming visible. Prepare work needed while the screen is visible.
onResume() When the Activity enters the foreground and can interact with the user. Start or resume behavior that requires foreground interaction.
onPause() When the Activity loses foreground focus, for example as another Activity comes forward. Briefly pause or release foreground-only behavior. Avoid slow or blocking work.
onStop() When the Activity is no longer visible. Stop work that only makes sense while the screen is visible; it can also be a fallback point for saving important changes.
onRestart() When a stopped Activity instance is returning. Prepare for visibility again; Android then calls onStart() and, if foregrounded, onResume().
onDestroy() When this instance is finishing or being destroyed for a recreation. Release remaining instance-specific resources. Do not rely on it as a guaranteed save callback.

How do the callbacks fit together?

Launching an Activity

A newly launched Activity typically receives onCreate(), then onStart(), then onResume(). At that point it is visible and ready for user interaction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Opening another Activity

When Activity A starts Activity B in the same process, A pauses while B is brought forward. B receives its creation, start, and resume callbacks; A then stops if it is no longer visible. The precise sequence can vary with what remains visible, so treat callbacks as state transitions rather than a fixed script for every screen arrangement.

Returning to a stopped Activity

If the same stopped instance becomes visible again, it receives onRestart(), followed by onStart() and onResume(). If Android instead destroyed the instance, returning requires a new instance and starts again at onCreate().

Finishing or losing the process

Finishing an Activity can lead to onPause(), onStop(), and onDestroy(). But process death is different: Android may terminate a background app process to reclaim memory, and the process’s in-memory objects disappear. The system does not promise an onDestroy() call before that happens. Save data according to its importance and lifetime, not on the assumption that a final callback will run.

What happens during rotation or another configuration change?

By default, a configuration change such as rotation can destroy the current Activity instance and create another. The old instance typically receives onPause(), onStop(), and onDestroy(); the new instance receives onCreate(), onStart(), and onResume(). A field stored only on the old instance does not automatically carry over. Android’s Activity state changes guide explains the transition and restoration options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Multi-window changes and resizing can also trigger configuration changes and recreation unless the app handles the changes itself. The behavior depends on the app’s configuration and manifest choices, so the default sequence should not be treated as universal.

Where should Activity state be stored?

Choose storage based on how long the information must last and how much data it contains. Android’s Activity API reference describes saved instance state; its state-change guidance compares restoration approaches.

Approach Best fit Lifetime and limits
Saved instance state or Compose rememberSaveable Small, temporary UI details such as text input or scroll position. Can restore state after Activity recreation and supported system-initiated process death. Keep it small: saved state is serialized on the main thread and uses process memory.
ViewModel Screen state and business logic that should remain available across configuration recreation. Retained in memory through configuration recreation, but does not by itself make arbitrary data durable through process death. Add saved-state support or persistent storage when that restoration is needed.
Persistent local storage User data that should outlive a screen or process, such as saved drafts or preferences. Designed for durable data. Save at an appropriate point during the user’s work rather than waiting for Activity destruction.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What work belongs in lifecycle callbacks?

Keep callbacks short and focused on the transition they represent. In particular, Android says not to use onPause() to save application or user data, make network calls, or execute database transactions. A slow operation there can delay the next Activity from appearing. Save important information earlier when practical; use onStop() only as a suitable fallback rather than treating destruction as a persistence strategy. See Android’s Introduction to activities.

For Jetpack Compose, use lifecycle-aware collection such as collectAsStateWithLifecycle for Flows and lifecycle effects for work tied to lifecycle events. Avoid placing business logic or manual observer setup directly in Activity callbacks such as onStart() and onResume(); Android’s lifecycle guide covers Compose-specific guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.