Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

Event

class Event
kotlin.Any
   ↳ kotlin.Enum<androidx.lifecycle.Lifecycle.Event>
   ↳ androidx.lifecycle.Lifecycle.Event

Summary

Enum values

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

Constant for onCreate event of the LifecycleOwner.

Constant for onDestroy event of the LifecycleOwner.

Constant for onPause event of the LifecycleOwner.

Constant for onResume event of the LifecycleOwner.

Constant for onStart event of the LifecycleOwner.

Constant for onStop event of the LifecycleOwner.

Public methods
static Lifecycle.Event?
downFrom(@NonNull state: Lifecycle.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.

static Lifecycle.Event?
downTo(@NonNull state: Lifecycle.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.

Lifecycle.State

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

static Lifecycle.Event?
upFrom(@NonNull state: Lifecycle.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.

static Lifecycle.Event?
upTo(@NonNull state: Lifecycle.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.

Enum values

ON_ANY

enum val ON_ANY : Lifecycle.Event

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

ON_CREATE

enum val ON_CREATE : Lifecycle.Event

Constant for onCreate event of the LifecycleOwner.

ON_DESTROY

enum val ON_DESTROY : Lifecycle.Event

Constant for onDestroy event of the LifecycleOwner.

ON_PAUSE

enum val ON_PAUSE : Lifecycle.Event

Constant for onPause event of the LifecycleOwner.

ON_RESUME

enum val ON_RESUME : Lifecycle.Event

Constant for onResume event of the LifecycleOwner.

ON_START

enum val ON_START : Lifecycle.Event

Constant for onStart event of the LifecycleOwner.

ON_STOP

enum val ON_STOP : Lifecycle.Event

Constant for onStop event of the LifecycleOwner.

Public methods

downFrom

@Nullable static fun downFrom(@NonNull 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
Return
Lifecycle.Event? the event moving down the lifecycle phases from state

downTo

@Nullable static fun downTo(@NonNull 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
Return
Lifecycle.Event? the event moving down the lifecycle phases to state

getTargetState

@NonNull fun getTargetState(): Lifecycle.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.

Return
Lifecycle.State the state that will result from this event

upFrom

@Nullable static fun upFrom(@NonNull 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
Return
Lifecycle.Event? the event moving up the lifecycle phases from state

upTo

@Nullable static fun upTo(@NonNull 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
Return
Lifecycle.Event? the event moving up the lifecycle phases to state