Lifecycle.State



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 functions

Boolean

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

Cmn
Lifecycle.State
valueOf(value: String)

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

Cmn
Array<Lifecycle.State>

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

Cmn

Public properties

EnumEntries<Lifecycle.State>

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Cmn

Enum Values

CREATED

val Lifecycle.State.CREATEDLifecycle.State

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

  • after android.app.Activity.onCreate call;

  • right before android.app.Activity.onStop call.

DESTROYED

val Lifecycle.State.DESTROYEDLifecycle.State

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 android.app.Activity.onDestroy call.

INITIALIZED

val Lifecycle.State.INITIALIZEDLifecycle.State

Initialized state for a LifecycleOwner. For an android.app.Activity, this is the state when it is constructed but has not received android.app.Activity.onCreate yet.

RESUMED

val Lifecycle.State.RESUMEDLifecycle.State

Resumed state for a LifecycleOwner. For an android.app.Activity, this state is reached after android.app.Activity.onResume is called.

STARTED

val Lifecycle.State.STARTEDLifecycle.State

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

  • after android.app.Activity.onStart call;

  • right before android.app.Activity.onPause call.

Public functions

isAtLeast

fun isAtLeast(state: Lifecycle.State): Boolean

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

Parameters
state: Lifecycle.State

State to compare with

Returns
Boolean

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

valueOf

fun valueOf(value: String): Lifecycle.State

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

fun values(): Array<Lifecycle.State>

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.

Public properties

entries

val entriesEnumEntries<Lifecycle.State>

Returns a representation of an immutable list of all enum entries, in the order they're declared.

This method may be used to iterate over the enum entries.