LifecycleRegistry


public class LifecycleRegistry extends Lifecycle


An implementation of Lifecycle that can handle multiple observers.

It is used by Fragments and Support Library Activities. You can also directly use it if you have a custom LifecycleOwner.

Summary

Public constructors

Public methods

void

Adds a LifecycleObserver that will be notified when the LifecycleOwner changes state.

static final @NonNull LifecycleRegistry

Creates a new LifecycleRegistry for the given provider, that doesn't check that its methods are called on the threads other than main.

@NonNull Lifecycle.State

Returns the current state of the Lifecycle.

@NonNull StateFlow<@NonNull Lifecycle.State>

Returns a StateFlow where the StateFlow.value represents the current State of this Lifecycle.

int