ILifecycleEventObserver

An interface for observing lifecycle events of a LifecycleOwner.

Implement this interface to receive notifications about specific lifecycle events. Each method corresponds to a distinct lifecycle event.

Functions

Link copied to clipboard
abstract fun onAny(lifecycleOwner: LifecycleOwner)

Called when any lifecycle event occurs.

Link copied to clipboard
abstract fun onCreate(lifecycleOwner: LifecycleOwner)

Notifies that ON_CREATE event occurred.

Link copied to clipboard
abstract fun onDestroy(lifecycleOwner: LifecycleOwner)

Called when the LifecycleOwner is being destroyed. This method is invoked once for a given LifecycleOwner. After this method is called, the LifecycleOwner is considered destroyed and will not receive any more lifecycle events.

Link copied to clipboard
abstract fun onPause(lifecycleOwner: LifecycleOwner)

Notifies that the ON_PAUSE event occurred.

Link copied to clipboard
abstract fun onResume(lifecycleOwner: LifecycleOwner)

Called when the lifecycle event ON_RESUME is received. This typically happens when the associated UI becomes visible and interactive again after being paused.

Link copied to clipboard
abstract fun onStart(lifecycleOwner: LifecycleOwner)

Called when the LifecycleOwner transitions to the STARTED state.

Link copied to clipboard
abstract fun onStop(lifecycleOwner: LifecycleOwner)

Called when the LifecycleOwner's state transitions to ON_STOP. This typically happens when the associated UI component is no longer visible to the user.