Event
class Event
kotlin.Any | ||
↳ | kotlin.Enum<androidx.lifecycle.Lifecycle.Event> | |
↳ | androidx.lifecycle.Lifecycle.Event |
Summary
Enum values | |
---|---|
An |
|
Constant for onCreate event of the |
|
Constant for onDestroy event of the |
|
Constant for onPause event of the |
|
Constant for onResume event of the |
|
Constant for onStart event of the |
|
Constant for onStop event of the |
Public methods | |
---|---|
static Lifecycle.Event? |
downFrom(@NonNull state: Lifecycle.State) Returns the |
static Lifecycle.Event? |
downTo(@NonNull state: Lifecycle.State) Returns the |
Lifecycle.State |
Returns the new |
static Lifecycle.Event? |
upFrom(@NonNull state: Lifecycle.State) Returns the |
static Lifecycle.Event? |
upTo(@NonNull state: Lifecycle.State) Returns the |
Enum values
ON_DESTROY
enum val ON_DESTROY : Lifecycle.Event
Constant for onDestroy 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 |