Stay organized with collections Save and categorize content based on your preferences.

DefaultLifecycleObserver

public interface DefaultLifecycleObserver
implements LifecycleObserver

android.arch.lifecycle.DefaultLifecycleObserver


Callback interface for listening to LifecycleOwner state changes.

If you use Java 8 language, always prefer it over annotations.

Summary

Public methods

default void onCreate(LifecycleOwner owner)

Notifies that ON_CREATE event occurred.

default void onDestroy(LifecycleOwner owner)

Notifies that ON_DESTROY event occurred.

default void onPause(LifecycleOwner owner)

Notifies that ON_PAUSE event occurred.

default void onResume(LifecycleOwner owner)

Notifies that ON_RESUME event occurred.

default void onStart(LifecycleOwner owner)

Notifies that ON_START event occurred.

default void onStop(LifecycleOwner owner)

Notifies that ON_STOP event occurred.

Public methods

onCreate

void onCreate (LifecycleOwner owner)

Notifies that ON_CREATE event occurred.

This method will be called after the LifecycleOwner's onCreate method returns.

Parameters
owner LifecycleOwner: the component, whose state was changed

onDestroy

void onDestroy (LifecycleOwner owner)

Notifies that ON_DESTROY event occurred.

This method will be called before the LifecycleOwner's onStop method is called.

Parameters
owner LifecycleOwner: the component, whose state was changed

onPause

void onPause (LifecycleOwner owner)

Notifies that ON_PAUSE event occurred.

This method will be called before the LifecycleOwner's onPause method is called.

Parameters
owner LifecycleOwner: the component, whose state was changed

onResume

void onResume (LifecycleOwner owner)

Notifies that ON_RESUME event occurred.

This method will be called after the LifecycleOwner's onResume method returns.

Parameters
owner LifecycleOwner: the component, whose state was changed

onStart

void onStart (LifecycleOwner owner)

Notifies that ON_START event occurred.

This method will be called after the LifecycleOwner's onStart method returns.

Parameters
owner LifecycleOwner: the component, whose state was changed

onStop

void onStop (LifecycleOwner owner)

Notifies that ON_STOP event occurred.

This method will be called before the LifecycleOwner's onStop method is called.

Parameters
owner LifecycleOwner: the component, whose state was changed