DefaultLifecycleObserver
public
interface
DefaultLifecycleObserver
implements
LifecycleObserver
androidx.lifecycle.DefaultLifecycleObserver |
Callback interface for listening to LifecycleOwner
state changes.
If you use Java 8 language, always prefer it over annotations.
If a class implements both this interface and LifecycleEventObserver
, then
methods of DefaultLifecycleObserver
will be called first, and then followed by the call
of LifecycleEventObserver.onStateChanged(LifecycleOwner, Lifecycle.Event)
If a class implements this interface and in the same time uses OnLifecycleEvent
, then
annotations will be ignored.
Summary
Public methods | |
---|---|
default
void
|
onCreate(LifecycleOwner owner)
Notifies that |
default
void
|
onDestroy(LifecycleOwner owner)
Notifies that |
default
void
|
onPause(LifecycleOwner owner)
Notifies that |
default
void
|
onResume(LifecycleOwner owner)
Notifies that |
default
void
|
onStart(LifecycleOwner owner)
Notifies that |
default
void
|
onStop(LifecycleOwner owner)
Notifies that |
Public methods
onCreate
public 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
public void onDestroy (LifecycleOwner owner)
Notifies that ON_DESTROY
event occurred.
This method will be called before the LifecycleOwner
's onDestroy
method
is called.
Parameters | |
---|---|
owner |
LifecycleOwner : the component, whose state was changed
|
onPause
public 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
public 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
public 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
public 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
|