DefaultLifecycleObserver


Known direct subclasses
AmbientLifecycleObserver

Interface for LifecycleObservers which are used to add ambient mode support to activities on Wearable devices.


Callback interface for listening to LifecycleOwner state changes.

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

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

Summary

Public functions

open Unit

Notifies that Lifecycle.Event.ON_CREATE event occurred.

Cmn
open Unit

Notifies that Lifecycle.Event.ON_DESTROY event occurred.

Cmn
open Unit

Notifies that Lifecycle.Event.ON_PAUSE event occurred.

Cmn
open Unit

Notifies that Lifecycle.Event.ON_RESUME event occurred.

Cmn
open Unit

Notifies that Lifecycle.Event.ON_START event occurred.

Cmn
open Unit

Notifies that Lifecycle.Event.ON_STOP event occurred.

Cmn

Public functions

onCreate

open fun onCreate(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_CREATE event occurred.

Called after the LifecycleOwner's onCreate method returns.

Parameters
owner: LifecycleOwner

The component whose state changed.

onDestroy

open fun onDestroy(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_DESTROY event occurred.

Called before the LifecycleOwner's onDestroy method is called.

Parameters
owner: LifecycleOwner

The component whose state changed.

onPause

open fun onPause(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_PAUSE event occurred.

Called before the LifecycleOwner's onPause method is called.

Parameters
owner: LifecycleOwner

The component whose state changed.

onResume

open fun onResume(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_RESUME event occurred.

Called after the LifecycleOwner's onResume method returns.

Parameters
owner: LifecycleOwner

The component whose state changed.

onStart

open fun onStart(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_START event occurred.

Called after the LifecycleOwner's onStart method returns.

Parameters
owner: LifecycleOwner

The component whose state changed.

onStop

open fun onStop(owner: LifecycleOwner): Unit

Notifies that Lifecycle.Event.ON_STOP event occurred.

Called before the LifecycleOwner's onStop method is called.

Parameters
owner: LifecycleOwner

The component whose state changed.