# Activity Lifecycle

There are many states, but in practice you use onCreate(), onResume(), onPause(), and onDestroy() most often. The activity goes through the creation flow when starting up and then follows a similar (but reverse) tear down flow when moving to the background.

## Active States

### Created

When onCreate() is called, the activity is being created, but not yet visible to the user. You can get references to view elements and configure long running processes.

### Started

When onStart() is called, the activity is being created and may be visible to the user, but the user won't be able to interact.

## Resumed

When onResume() is called, the activity is visible to the user and ready for user input.

## Inactive

When onPause() is called, the activity is still partially visible. The user may have been shown a dialog or other item that briefly takes the focus away from the active Activity. It's possible that they may resume the activity shortly, but you should start preparing for the tear down.

## Stopped

When onStop() is called, the activity is hidden and may be cleaned up if resources are needed for the new (and currently displayed) activity that a user is interacting with.

## Destroyed

onDestroy() is called right before your activity is destroyed.

This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.