LifecycleEventObserver


public fun interface LifecycleEventObserver extends LifecycleObserver


Interface for receiving any Lifecycle.Event state changes.

If a class implements both this interface and DefaultLifecycleObserver, the methods of DefaultLifecycleObserver are called first, followed by onStateChanged.

Note: If a class implements this interface and also uses the deprecated androidx.lifecycle.OnLifecycleEvent annotations, those annotations are ignored.

Summary

Public methods

abstract void
onStateChanged(
    @NonNull LifecycleOwner source,
    @NonNull Lifecycle.Event event
)

Called when a state transition event occurs.

Public methods

onStateChanged

Added in 2.1.0
abstract void onStateChanged(
    @NonNull LifecycleOwner source,
    @NonNull Lifecycle.Event event
)

Called when a state transition event occurs.