Skip to content

Most visited

Recently visited

navigation

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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)