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 voidonCreate(LifecycleOwner owner) Notifies thatON_CREATEevent occurred.default voidonDestroy(LifecycleOwner owner) Notifies thatON_DESTROYevent occurred.default voidonPause(LifecycleOwner owner) Notifies thatON_PAUSEevent occurred.default voidonResume(LifecycleOwner owner) Notifies thatON_RESUMEevent occurred.default voidonStart(LifecycleOwner owner) Notifies thatON_STARTevent occurred.default voidonStateChanged(LifecycleOwner source, Lifecycle.Event event) Called when a state transition event happens.default voidonStop(LifecycleOwner owner) Notifies thatON_STOPevent occurred.
-
Method Details
-
onCreate
Notifies thatON_CREATEevent occurred.This method will be called after the
LifecycleOwner'sonCreatemethod returns.- Parameters:
owner- the component, whose state was changed
-
onStart
Notifies thatON_STARTevent occurred.This method will be called after the
LifecycleOwner'sonStartmethod returns.- Parameters:
owner- the component, whose state was changed
-
onResume
Notifies thatON_RESUMEevent occurred.This method will be called after the
LifecycleOwner'sonResumemethod returns.- Parameters:
owner- the component, whose state was changed
-
onPause
Notifies thatON_PAUSEevent occurred.This method will be called before the
LifecycleOwner'sonPausemethod is called.- Parameters:
owner- the component, whose state was changed
-
onStop
Notifies thatON_STOPevent occurred.This method will be called before the
LifecycleOwner'sonStopmethod is called.- Parameters:
owner- the component, whose state was changed
-
onDestroy
Notifies thatON_DESTROYevent occurred.This method will be called before the
LifecycleOwner'sonStopmethod 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
-