LifecycleObserver


Known direct subclasses
DefaultLifecycleObserver

Callback interface for listening to LifecycleOwner state changes.

LifecycleEventObserver

Interface for receiving any Lifecycle.Event state changes.

Known indirect subclasses
AmbientLifecycleObserver

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


Marker interface that indicates a class is a LifecycleObserver.

This interface is the common type for all lifecycle observer implementations. It allows you to add any observer type to a Lifecycle using Lifecycle.addObserver.

Deprecation Note: Do not implement this interface directly. The lifecycle-compiler annotation processor and annotating methods with @OnLifecycleEvent are deprecated.

Implement one of the following interfaces instead:

  • DefaultLifecycleObserver (Recommended): Implement this interface to receive specific lifecycle callbacks (such as onCreate, onStart, and others) using overridden methods.

  • LifecycleEventObserver: Implement this interface if you need to handle all lifecycle event state transitions in a single onStateChanged callback.

See also
Lifecycle

for details and usage patterns.