Lifecycle.State

public enum Lifecycle.State extends Enum


Lifecycle states. You can consider the states as the nodes in a graph and Events as the edges between these nodes.

Summary

Enum Values

CREATED

Created state for a LifecycleOwner.

DESTROYED

Destroyed state for a LifecycleOwner.

INITIALIZED

Initialized state for a LifecycleOwner.

RESUMED

Resumed state for a LifecycleOwner.

STARTED

Started state for a LifecycleOwner.

Public methods

final boolean

Compares if this State is greater or equal to the given state.

final @NonNull Lifecycle.State

Returns the enum constant of this type with the specified name.

final @NonNull Lifecycle.State[]

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 LifecycleOwner. For an android.app.Activity, this state is reached in two cases:

DESTROYED

Lifecycle.State Lifecycle.State.DESTROYED

Destroyed state for a LifecycleOwner. After this event, this Lifecycle will not dispatch any more events. For instance, for an android.app.Activity, this state is reached right before Activity's onDestroy call.

INITIALIZED

Lifecycle.State Lifecycle.State.INITIALIZED

Initialized state for a LifecycleOwner. For an android.app.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 LifecycleOwner. For an android.app.Activity, this state is reached after onResume is called.

STARTED

Lifecycle.State Lifecycle.State.STARTED

Started state for a LifecycleOwner. For an android.app.Activity, this state is reached in two cases:

Public methods

isAtLeast

Added in 2.0.0
public final boolean isAtLeast(@NonNull Lifecycle.State state)

Compares if this State is greater or equal to the given state.

Parameters
@NonNull Lifecycle.State state

State to compare with

Returns
boolean

true if this State is greater or equal to the given state

valueOf

Added in 2.0.0
public 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
kotlin.IllegalArgumentException

if this enum type has no constant with the specified name

values

Added in 2.0.0
public 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.