Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

LifecycleEventObserver

interface LifecycleEventObserver : LifecycleObserver
androidx.lifecycle.LifecycleEventObserver

Class that can receive any lifecycle change and dispatch it to the receiver.

If a class implements both this interface and androidx.lifecycle.DefaultLifecycleObserver, then methods of DefaultLifecycleObserver will be called first, and then followed by the call of LifecycleEventObserver#onStateChanged(LifecycleOwner, Lifecycle.Event)

If a class implements this interface and in the same time uses OnLifecycleEvent, then annotations will be ignored.

Summary

Public methods
abstract Unit
onStateChanged(@NonNull source: LifecycleOwner, @NonNull event: Lifecycle.Event)

Called when a state transition event happens.

Public methods

onStateChanged

abstract fun onStateChanged(@NonNull source: LifecycleOwner, @NonNull event: Lifecycle.Event): Unit

Called when a state transition event happens.

Parameters
source LifecycleOwner: The source of the event
event LifecycleOwner: The event