Package icyllis.modernui.lifecycle
Interface LifecycleObserver
public interface LifecycleObserver
Callback interface for listening to
LifecycleOwner
state changes.
Methods like onCreate(LifecycleOwner)
will be called first, and then
followed by the call of onStateChanged(LifecycleOwner, Lifecycle.Event)
.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
onCreate
(LifecycleOwner owner) Notifies thatON_CREATE
event occurred.default void
onDestroy
(LifecycleOwner owner) Notifies thatON_DESTROY
event occurred.default void
onPause
(LifecycleOwner owner) Notifies thatON_PAUSE
event occurred.default void
onResume
(LifecycleOwner owner) Notifies thatON_RESUME
event occurred.default void
onStart
(LifecycleOwner owner) Notifies thatON_START
event occurred.default void
onStateChanged
(LifecycleOwner source, Lifecycle.Event event) Called when a state transition event happens.default void
onStop
(LifecycleOwner owner) Notifies thatON_STOP
event occurred.
-
Method Details
-
onCreate
Notifies thatON_CREATE
event occurred.This method will be called after the
LifecycleOwner
'sonCreate
method returns.- Parameters:
owner
- the component, whose state was changed
-
onStart
Notifies thatON_START
event occurred.This method will be called after the
LifecycleOwner
'sonStart
method returns.- Parameters:
owner
- the component, whose state was changed
-
onResume
Notifies thatON_RESUME
event occurred.This method will be called after the
LifecycleOwner
'sonResume
method returns.- Parameters:
owner
- the component, whose state was changed
-
onPause
Notifies thatON_PAUSE
event occurred.This method will be called before the
LifecycleOwner
'sonPause
method is called.- Parameters:
owner
- the component, whose state was changed
-
onStop
Notifies thatON_STOP
event occurred.This method will be called before the
LifecycleOwner
'sonStop
method is called.- Parameters:
owner
- the component, whose state was changed
-
onDestroy
Notifies thatON_DESTROY
event occurred.This method will be called before the
LifecycleOwner
'sonStop
method is called.- Parameters:
owner
- the component, whose state was changed
-
onStateChanged
Called when a state transition event happens.- Parameters:
source
- The source of the eventevent
- The event
-