Lifecycle.Event

enum Lifecycle.Event : Enum


Summary

Enum Values

ON_ANY

An Event constant that can be used to match all events.

ON_CREATE

Constant for onCreate event of the LifecycleOwner.

ON_DESTROY

Constant for onDestroy event of the LifecycleOwner.

ON_PAUSE

Constant for onPause event of the LifecycleOwner.

ON_RESUME

Constant for onResume event of the LifecycleOwner.

ON_START

Constant for onStart event of the LifecycleOwner.

ON_STOP

Constant for onStop event of the LifecycleOwner.

Public companion functions

Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle leaving the specified Lifecycle.State to a lower state, or null if there is no valid event that can move down from the given state.

Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle entering the specified Lifecycle.State from a higher state, or null if there is no valid event that can move down to the given state.

Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle leaving the specified Lifecycle.State to a higher state, or null if there is no valid event that can move up from the given state.

Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle entering the specified Lifecycle.State from a lower state, or null if there is no valid event that can move up to the given state.

Public functions

Lifecycle.Event
valueOf(value: String)

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

Array<Lifecycle.Event>

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

Public properties

Lifecycle.State

Returns the new Lifecycle.State of a Lifecycle that just reported this Lifecycle.Event.

Enum Values

ON_ANY

val Lifecycle.Event.ON_ANYLifecycle.Event

An Event constant that can be used to match all events.

ON_CREATE

val Lifecycle.Event.ON_CREATELifecycle.Event

Constant for onCreate event of the LifecycleOwner.

ON_DESTROY

val Lifecycle.Event.ON_DESTROYLifecycle.Event

Constant for onDestroy event of the LifecycleOwner.

ON_PAUSE

val Lifecycle.Event.ON_PAUSELifecycle.Event

Constant for onPause event of the LifecycleOwner.

ON_RESUME

val Lifecycle.Event.ON_RESUMELifecycle.Event

Constant for onResume event of the LifecycleOwner.

ON_START

val Lifecycle.Event.ON_STARTLifecycle.Event

Constant for onStart event of the LifecycleOwner.

ON_STOP

val Lifecycle.Event.ON_STOPLifecycle.Event

Constant for onStop event of the LifecycleOwner.

Public companion functions

downFrom

Added in 2.6.0
fun downFrom(state: Lifecycle.State): Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle leaving the specified Lifecycle.State to a lower state, or null if there is no valid event that can move down from the given state.

Parameters
state: Lifecycle.State

the higher state that the returned event will transition down from

Returns
Lifecycle.Event?

the event moving down the lifecycle phases from state

downTo

Added in 2.6.0
fun downTo(state: Lifecycle.State): Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle entering the specified Lifecycle.State from a higher state, or null if there is no valid event that can move down to the given state.

Parameters
state: Lifecycle.State

the lower state that the returned event will transition down to

Returns
Lifecycle.Event?

the event moving down the lifecycle phases to state

upFrom

Added in 2.6.0
fun upFrom(state: Lifecycle.State): Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle leaving the specified Lifecycle.State to a higher state, or null if there is no valid event that can move up from the given state.

Parameters
state: Lifecycle.State

the lower state that the returned event will transition up from

Returns
Lifecycle.Event?

the event moving up the lifecycle phases from state

upTo

Added in 2.6.0
fun upTo(state: Lifecycle.State): Lifecycle.Event?

Returns the Lifecycle.Event that will be reported by a Lifecycle entering the specified Lifecycle.State from a lower state, or null if there is no valid event that can move up to the given state.

Parameters
state: Lifecycle.State

the higher state that the returned event will transition up to

Returns
Lifecycle.Event?

the event moving up the lifecycle phases to state

Public functions

valueOf

Added in 2.0.0
fun valueOf(value: String): Lifecycle.Event

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
fun values(): Array<Lifecycle.Event>

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

targetState

Added in 2.3.0
val targetStateLifecycle.State

Returns the new Lifecycle.State of a Lifecycle that just reported this Lifecycle.Event.

Throws IllegalArgumentException if called on .ON_ANY, as it is a special value used by OnLifecycleEvent and not a real lifecycle event.

Returns
Lifecycle.State

the state that will result from this event