SubLifecycleOwner

An owner of a sub-lifecycle of the given parentLifecycleOwner. The state of the sub-lifecycle is always in a state that is at most the parentLifecycleOwner's state. It can be a lower state either due to being limited with stateLimit or if the sub-lifecycle is destroyed.

The stateLimit allows the sub-lifecycle state, for instance, to remain in the State.CREATED state when parentLifecycleOwner's state is State.STARTED or State.RESUMED.

The sub-lifecycle owner may be destroyed sooner than the destruction of parentLifecycleOwner.

Constructors

Link copied to clipboard
constructor(parentLifecycleOwner: LifecycleOwner)

Properties

Link copied to clipboard
open override val lifecycle: Lifecycle
Link copied to clipboard

Limits the states of this lifecycle owner to the given value.

Functions

Link copied to clipboard
open override fun destroy()

Moves the sub-lifecycle owner to the destroyed state. After this call, it will no longer follow the lifecycle of its parent.

Inherited functions

Link copied to clipboard

Creates a new LifecycleOwner that limits the state of this LifecycleOwner to Lifecycle.State.CREATED if the view is detached.