Package dagger.hilt.android.lifecycle
Interface RetainedLifecycle
- All Known Subinterfaces:
ActivityRetainedLifecycle
,ViewModelLifecycle
- All Known Implementing Classes:
RetainedLifecycleImpl
public interface RetainedLifecycle
A class for registered listeners on a retained lifecycle (generally backed up by a ViewModel).
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Listener for when the retained lifecycle is cleared. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a newRetainedLifecycle.OnClearedListener
for receiving a callback when the lifecycle is cleared.void
Removes aRetainedLifecycle.OnClearedListener
previously added viaaddOnClearedListener(OnClearedListener)
.
-
Method Details
-
addOnClearedListener
Adds a newRetainedLifecycle.OnClearedListener
for receiving a callback when the lifecycle is cleared.- Parameters:
listener
- The listener that should be added.
-
removeOnClearedListener
Removes aRetainedLifecycle.OnClearedListener
previously added viaaddOnClearedListener(OnClearedListener)
.- Parameters:
listener
- The listener that should be removed.
-