public enum

Lifecycle.Event

extends java.lang.Enum<Lifecycle.Event>

 java.lang.Object

↳java.lang.Enum<Lifecycle.Event>

↳androidx.lifecycle.Lifecycle.Event

Summary

Enum Constants
ON_ANYAn Event constant that can be used to match all events.
ON_CREATEConstant for onCreate event of the LifecycleOwner.
ON_DESTROYConstant for onDestroy event of the LifecycleOwner.
ON_PAUSEConstant for onPause event of the LifecycleOwner.
ON_RESUMEConstant for onResume event of the LifecycleOwner.
ON_STARTConstant for onStart event of the LifecycleOwner.
ON_STOPConstant for onStop event of the LifecycleOwner.
Methods
public static Lifecycle.EventdownFrom(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.

public static Lifecycle.EventdownTo(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.

public Lifecycle.StategetTargetState()

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

public static Lifecycle.EventupFrom(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.

public static Lifecycle.EventupTo(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.

public static Lifecycle.EventvalueOf(java.lang.String name)

public static Lifecycle.Eventvalues()

from java.lang.Enum<E>clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
from java.lang.ObjectgetClass, notify, notifyAll, wait, wait, wait

Enum Constants

ON_CREATE

Constant for onCreate event of the LifecycleOwner.

ON_START

Constant for onStart event of the LifecycleOwner.

ON_RESUME

Constant for onResume event of the LifecycleOwner.

ON_PAUSE

Constant for onPause event of the LifecycleOwner.

ON_STOP

Constant for onStop event of the LifecycleOwner.

ON_DESTROY

Constant for onDestroy event of the LifecycleOwner.

ON_ANY

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

Methods

public static Lifecycle.Event values()

public static Lifecycle.Event valueOf(java.lang.String name)

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: the higher state that the returned event will transition down from

Returns:

the event moving down the lifecycle phases from state

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: the lower state that the returned event will transition down to

Returns:

the event moving down the lifecycle phases to state

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: the lower state that the returned event will transition up from

Returns:

the event moving up the lifecycle phases from state

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: the higher state that the returned event will transition up to

Returns:

the event moving up the lifecycle phases to state

public Lifecycle.State getTargetState()

Returns the new Lifecycle.State of a Lifecycle that just reported this Lifecycle.Event. Throws java.lang.IllegalArgumentException if called on Lifecycle.Event.ON_ANY, as it is a special value used by OnLifecycleEvent and not a real lifecycle event.

Returns:

the state that will result from this event