Lifecycle.Event
public enum Lifecycle.Event extends Enum
Summary
Enum Values |
|
|---|---|
ON_ANY |
An |
ON_CREATE |
Constant for onCreate event of the |
ON_DESTROY |
Constant for onDestroy event of the |
ON_PAUSE |
Constant for onPause event of the |
ON_RESUME |
Constant for onResume event of the |
ON_START |
Constant for onStart event of the |
ON_STOP |
Constant for onStop event of the |
Public methods |
|
|---|---|
static final Lifecycle.Event |
downFrom(@NonNull Lifecycle.State state)Returns the |
static final Lifecycle.Event |
downTo(@NonNull Lifecycle.State state)Returns the |
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 |
static final Lifecycle.Event |
upFrom(@NonNull Lifecycle.State state)Returns the |
static final Lifecycle.Event |
upTo(@NonNull Lifecycle.State state)Returns the |
final @NonNull Lifecycle.Event |
Returns the enum constant of this type with the specified name. |
final @NonNull Lifecycle.Event[] |
values()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_RESUME
Lifecycle.Event Lifecycle.Event.ON_RESUME
Constant for onResume event of the LifecycleOwner.
Public methods
downFrom
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
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.Event> getEntries()
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
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
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
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
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 |