# Lifecycle.Event

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.Event) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.0.0)

*** ** * ** ***


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

<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.Event](https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event)\> ||
|   | ↳ | [androidx.lifecycle.Lifecycle.Event](https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event) |

*** ** * ** ***

Represents a transition event triggered by a change in the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s state.

Together with `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State`s, these events form a directed graph defining the valid lifecycle flow of a component:

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

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

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_ANY` | A wildcard event constant that matches all `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`s. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_CREATE` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the created state. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to be destroyed. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to leave the resumed state. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_RESUME` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the resumed state. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_START` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the started state. |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP` | Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to leave the started state. |

| ### Public methods |
|---|---|
| `static final https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#downFrom(androidx.lifecycle.Lifecycle.State)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state)` Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions down from the specified `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downFrom(androidx.lifecycle.Lifecycle.State)` to a lower state, or `null` if no transition exists. |
| `static final https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#downTo(androidx.lifecycle.Lifecycle.State)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state)` Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions down into the specified target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downTo(androidx.lifecycle.Lifecycle.State)`, or `null` if no transition exists. |
| `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.Event>` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#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 @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.Event#getTargetState()()` Returns the new `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` that just reported this `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`. |
| `static final https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#upFrom(androidx.lifecycle.Lifecycle.State)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state)` Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions up from the specified `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upFrom(androidx.lifecycle.Lifecycle.State)` to a higher state, or `null` if no transition exists. |
| `static final https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#upTo(androidx.lifecycle.Lifecycle.State)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State state)` Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions up into the specified target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upTo(androidx.lifecycle.Lifecycle.State)`, or `null` if no transition exists. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#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.Event[]` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### ON_ANY

```
Lifecycle.Event Lifecycle.Event.ON_ANY
```

A wildcard event constant that matches all `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`s.

### ON_CREATE

```
Lifecycle.Event Lifecycle.Event.ON_CREATE
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the created state.

Called after the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onCreate` returns. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`.

### ON_DESTROY

```
Lifecycle.Event Lifecycle.Event.ON_DESTROY
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to be destroyed.

Called before the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onDestroy` is called. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED`.

### ON_PAUSE

```
Lifecycle.Event Lifecycle.Event.ON_PAUSE
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to leave the resumed state.

Called before the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onPause` is called. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`.

### ON_RESUME

```
Lifecycle.Event Lifecycle.Event.ON_RESUME
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the resumed state.

Called after the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onResume` returns. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED`.

### ON_START

```
Lifecycle.Event Lifecycle.Event.ON_START
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` enters the started state.

Called after the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onStart` returns. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`.

### ON_STOP

```
Lifecycle.Event Lifecycle.Event.ON_STOP
```

Dispatched when the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is about to leave the started state.

Called before the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s `onStop` is called. Transitions the lifecycle to `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED`.

## Public methods

### downFrom

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

```
public static final Lifecycle.Event downFrom(@NonNull Lifecycle.State state)
```

Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions down from the specified `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downFrom(androidx.lifecycle.Lifecycle.State)` to a lower state, or `null` if no transition exists.

|---|---|
| Given `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downFrom(androidx.lifecycle.Lifecycle.State)` | Returned `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` |

### downTo

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

```
public static final Lifecycle.Event downTo(@NonNull Lifecycle.State state)
```

Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions down into the specified target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downTo(androidx.lifecycle.Lifecycle.State)`, or `null` if no transition exists.

|---|---|
| Target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#downTo(androidx.lifecycle.Lifecycle.State)` | Returned `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` | `null` |

### getEntries

```
public final @NonNull EnumEntries<@NonNull Lifecycle.Event> 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.

### getTargetState

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

```
public final @NonNull Lifecycle.State getTargetState()
```

Returns the new `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` of a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` that just reported this `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event`.

|---|---|
| Reported `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` | Resulting `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_CREATE` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_START` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_RESUME` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_ANY` | throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` |

### upFrom

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

```
public static final Lifecycle.Event upFrom(@NonNull Lifecycle.State state)
```

Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions up from the specified `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upFrom(androidx.lifecycle.Lifecycle.State)` to a higher state, or `null` if no transition exists.

|---|---|
| Given `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upFrom(androidx.lifecycle.Lifecycle.State)` | Returned `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_CREATE` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_START` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_RESUME` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` | `null` |

### upTo

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

```
public static final Lifecycle.Event upTo(@NonNull Lifecycle.State state)
```

Returns the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` that transitions up into the specified target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upTo(androidx.lifecycle.Lifecycle.State)`, or `null` if no transition exists.

|---|---|
| Target `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event.Companion#upTo(androidx.lifecycle.Lifecycle.State)` | Returned `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#INITIALIZED` | `null` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_CREATE` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_START` |
| `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#RESUMED` | `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_RESUME` |

### valueOf

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

```
public static final @NonNull Lifecycle.Event 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.Event[] 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.