{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

Lifecycle.State

enum Lifecycle.State : Enum

kotlin.Any
   ↳ kotlin.Enum
     ↳ androidx.lifecycle.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.

Lifecycle.State
valueOf(value: String)

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

Array<Lifecycle.State>

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

Public properties

EnumEntries<Lifecycle.State>

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

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:

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 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 onCreate yet.

RESUMED

val Lifecycle.State.RESUMEDLifecycle.State

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

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.