Lifecycle.Event


public enum Lifecycle.Event extends 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 methods

static final 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.

static final 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.

final @NonNull EnumEntries<@NonNull Lifecycle.Event>

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

final @NonNull Lifecycle.State

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

static final 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.

static final 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.

final @NonNull Lifecycle.Event

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

final @NonNull Lifecycle.Event[]

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

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

ON_CREATE

Lifecycle.Event Lifecycle.Event.ON_CREATE

Constant for onCreate event of the LifecycleOwner.

ON_DESTROY

Lifecycle.Event Lifecycle.Event.ON_DESTROY

Constant for onDestroy event of the LifecycleOwner.

ON_PAUSE

Lifecycle.Event Lifecycle.Event.ON_PAUSE

Constant for onPause event of the LifecycleOwner.

ON_RESUME

Lifecycle.Event Lifecycle.Event.ON_RESUME

Constant for onResume event of the LifecycleOwner.

ON_START

Lifecycle.Event Lifecycle.Event.ON_START

Constant for onStart event of the LifecycleOwner.

ON_STOP

Lifecycle.Event Lifecycle.Event.ON_STOP

Constant for onStop event of the LifecycleOwner.

Public methods

downFrom

Added in 2.6.0
public static final Lifecycle.Event downFrom(@NonNull Lifecycle.State state)

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
@NonNull Lifecycle.State 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
public static final Lifecycle.Event downTo(@NonNull Lifecycle.State state)

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
@NonNull Lifecycle.State state

the lower state that the returned event will transition down to

Returns
Lifecycle.Event

the event moving down the lifecycle phases to state

getEntries

public final @NonNull EnumEntries<@NonNull Lifecycle.EventgetEntries()

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.

getTargetState

Added in 2.3.0
public final @NonNull Lifecycle.State getTargetState()

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
@NonNull Lifecycle.State

the state that will result from this event

upFrom

Added in 2.6.0
public static final Lifecycle.Event upFrom(@NonNull Lifecycle.State state)

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
@NonNull Lifecycle.State 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
public static final Lifecycle.Event upTo(@NonNull Lifecycle.State state)

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
@NonNull Lifecycle.State state

the higher state that the returned event will transition up to

Returns
Lifecycle.Event

the event moving up the lifecycle phases to state

valueOf

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

if this enum type has no constant with the specified name

values

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