@MainThread public class LifecycleComposite extends Object implements LifecycleCallbacks
LifecycleComposite provides lifecycle events to
the registered LifecycleCallbacks objects.| Constructor and Description |
|---|
LifecycleComposite() |
| Modifier and Type | Method and Description |
|---|---|
void |
onPause()
This method should be called when the activity or fragment is
being paused.
|
void |
onResume()
This method will be called when the activity or fragment is
being resumed.
|
void |
onStart()
This method will be called when the activity or fragment is
being started.
|
void |
onStop()
This method will be called when the activity or fragment is
being stopped.
|
void |
registerLifecycleCallbacks(LifecycleCallbacks lifecycleCallbacks)
Add a new
LifecycleCallbacks to the LifecycleComposite,
which will be called at the same times as the lifecycle methods of
activities or fragments are called. |
void |
unregisterLifecycleCallbacks(LifecycleCallbacks lifecycleCallbacks)
Remove a
LifecycleCallbacks object that was previously registered
with registerLifecycleCallbacks(LifecycleCallbacks). |
public void registerLifecycleCallbacks(@NonNull LifecycleCallbacks lifecycleCallbacks)
LifecycleCallbacks to the LifecycleComposite,
which will be called at the same times as the lifecycle methods of
activities or fragments are called. Note that you
must be sure to use unregisterLifecycleCallbacks(LifecycleCallbacks)
when appropriate in the future; this will not be removed for you.
The LifecycleComposite holds latest known lifecycle state to be sent
to any later registrations.
lifecycleCallbacks - The interface to call.public void unregisterLifecycleCallbacks(@NonNull LifecycleCallbacks lifecycleCallbacks)
LifecycleCallbacks object that was previously registered
with registerLifecycleCallbacks(LifecycleCallbacks).public void onStart()
onStart in interface LifecycleCallbacksActivity.onStart(),
Fragment.onStart(),
Fragmentpublic void onResume()
onResume in interface LifecycleCallbacksActivity.onResume(),
Fragment.onResume(),
Fragmentpublic void onPause()
onPause in interface LifecycleCallbacksActivity.onPause(),
Fragment.onPause(),
Fragmentpublic void onStop()
onStop in interface LifecycleCallbacksActivity.onStop(),
Fragment.onStop(),
Fragment