Lifecycle.Event
public
static
final
enum
Lifecycle.Event
extends Enum<Lifecycle.Event>
java.lang.Object | ||
↳ | java.lang.Enum<androidx.lifecycle.Lifecycle.Event> | |
↳ | androidx.lifecycle.Lifecycle.Event |
Summary
Enum values | |
---|---|
Lifecycle.Event |
ON_ANY
An |
Lifecycle.Event |
ON_CREATE
Constant for onCreate event of the |
Lifecycle.Event |
ON_DESTROY
Constant for onDestroy event of the |
Lifecycle.Event |
ON_PAUSE
Constant for onPause event of the |
Lifecycle.Event |
ON_RESUME
Constant for onResume event of the |
Lifecycle.Event |
ON_START
Constant for onStart event of the |
Lifecycle.Event |
ON_STOP
Constant for onStop event of the |
Public methods | |
---|---|
static
Lifecycle.Event
|
downFrom(Lifecycle.State state)
Returns the |
static
Lifecycle.Event
|
downTo(Lifecycle.State state)
Returns the |
Lifecycle.State
|
getTargetState()
Returns the new |
static
Lifecycle.Event
|
upFrom(Lifecycle.State state)
Returns the |
static
Lifecycle.Event
|
upTo(Lifecycle.State state)
Returns the |
static
Lifecycle.Event
|
valueOf(String name)
|
static
final
Event[]
|
values()
|
Inherited methods | |
---|---|
Enum values
ON_ANY
public static final Lifecycle.Event ON_ANY
An Event
constant that can be used to match all events.
ON_CREATE
public static final Lifecycle.Event ON_CREATE
Constant for onCreate event of the LifecycleOwner
.
ON_DESTROY
public static final Lifecycle.Event ON_DESTROY
Constant for onDestroy event of the LifecycleOwner
.
ON_PAUSE
public static final Lifecycle.Event ON_PAUSE
Constant for onPause event of the LifecycleOwner
.
ON_RESUME
public static final Lifecycle.Event ON_RESUME
Constant for onResume event of the LifecycleOwner
.
ON_START
public static final Lifecycle.Event ON_START
Constant for onStart event of the LifecycleOwner
.
ON_STOP
public static final Lifecycle.Event ON_STOP
Constant for onStop event of the LifecycleOwner
.
Public methods
downFrom
public static Lifecycle.Event downFrom (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 | |
---|---|
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
public static Lifecycle.Event downTo (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 | |
---|---|
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 |
getTargetState
public 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 | |
---|---|
Lifecycle.State |
the state that will result from this event |
upFrom
public static Lifecycle.Event upFrom (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 | |
---|---|
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
public static Lifecycle.Event upTo (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 | |
---|---|
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 |
valueOf
public static Lifecycle.Event valueOf (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
Lifecycle.Event |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.