# Lifecycle.State

Artifact: [androidx.lifecycle:lifecycle-common](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/Lifecycle.kt+class:androidx.lifecycle.Lifecycle.State) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

*** ** * ** ***


```
public enum Lifecycle.State extends Enum<@NonNull Lifecycle.State>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [kotlin.Enum](https://developer.android.com/reference/java/lang/Enum.html)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [Lifecycle.State](https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State)\> ||
|   | ↳ | [androidx.lifecycle.Lifecycle.State](https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State) |

*** ** * ** ***

Represents the current lifecycle state of a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

You can visualize these states as nodes in a graph where `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`s represent the directed edges guiding transitions between them:

```
           +---+
           | INITIALIZED |
           +---+
                  |
                  | ON_CREATE
                  v
             +---+
             | CREATED | ---+
             +---+           |
              |       ^            |
     ON_START |       | ON_STOP    |
              v       |            | ON_DESTROY
             +---+           |
             | STARTED |           |
             +---+           |
              |       ^            |
    ON_RESUME |       | ON_PAUSE   |
              v       |            v
             +---+     +---+
             | RESUMED |     | DESTROYED |
             +---+     +---+
```

Transitions between these states occur strictly sequentially. When moving between non-adjacent states, the registry dispatches all intermediate `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`s. For example, transitioning from `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` will sequentially dispatch `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE`, `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP`, and `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | for the transition events between these states. |

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` | Created state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` | Destroyed state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED` | Initialized state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` | Resumed state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` | Started state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State>` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#getEntries()()` Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared. |
| `final boolean` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#isAtLeast(androidx.lifecycle.Lifecycle.State)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state)` Returns true if this state is greater than or equal to the given `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#isAtLeast(androidx.lifecycle.Lifecycle.State)`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#valueOf(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Returns the enum constant of this type with the specified name. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull Lifecycle.State[]` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### CREATED

```
Lifecycle.State Lifecycle.State.CREATED
```

Created state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

**This is a cyclic state.** The lifecycle can transition back and forth between `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`, `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`, and `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` states.

For instance, for an Android Activity, this state is reached after the activity's `onCreate` returns, or right before `onStop` is called.

### DESTROYED

```
Lifecycle.State Lifecycle.State.DESTROYED
```

Destroyed state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

**This is the terminal state.** Once reached, this `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` will not dispatch any more events, and it cannot transition to any other state.

For instance, for an Android Activity, this state is reached right before the activity's `onDestroy` is called.

### INITIALIZED

```
Lifecycle.State Lifecycle.State.INITIALIZED
```

Initialized state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

**This is the initial state.** Once the lifecycle transitions out of this state, it cannot transition back to it.

For instance, for an Android Activity, this is the state when it is constructed but has not received `onCreate` yet.

### RESUMED

```
Lifecycle.State Lifecycle.State.RESUMED
```

Resumed state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

**This is a cyclic state.** The lifecycle can transition back and forth between `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`, `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`, and `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` states.

For instance, for an Android Activity, this state is reached after the activity's `onResume` returns.

### STARTED

```
Lifecycle.State Lifecycle.State.STARTED
```

Started state for a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`.

**This is a cyclic state.** The lifecycle can transition back and forth between `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`, `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`, and `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` states.

For instance, for an Android Activity, this state is reached after the activity's `onStart` returns, or right before `onPause` is called.

## Public methods

### getEntries

```
public final @NonNull EnumEntries<@NonNull Lifecycle.State> getEntries()
```

Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared.

### isAtLeast

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

```
public final boolean isAtLeast(@NonNull Lifecycle.State state)
```

Returns true if this state is greater than or equal to the given `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#isAtLeast(androidx.lifecycle.Lifecycle.State)`.

States are ordered as `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED`\<`https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED`\<`https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`\<`https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`\<`https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED`.

### valueOf

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

```
public static final @NonNull Lifecycle.State valueOf(@NonNull String value)
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this enum type has no constant with the specified name |

### values

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

```
public static final @NonNull Lifecycle.State[] values()
```

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using `entries` property as a more efficient alternative returning an immutable list of enum entries.