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
Nested Classes Modifier and Type Interface Description static interface
RetainedLifecycle.OnClearedListener
Listener for when the retained lifecycle is cleared.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addOnClearedListener(RetainedLifecycle.OnClearedListener listener)
Adds a newRetainedLifecycle.OnClearedListener
for receiving a callback when the lifecycle is cleared.void
removeOnClearedListener(RetainedLifecycle.OnClearedListener listener)
Removes aRetainedLifecycle.OnClearedListener
previously added viaaddOnClearedListener(OnClearedListener)
.
-
-
-
Method Detail
-
addOnClearedListener
@MainThread void addOnClearedListener(@NonNull RetainedLifecycle.OnClearedListener listener)
Adds a newRetainedLifecycle.OnClearedListener
for receiving a callback when the lifecycle is cleared.- Parameters:
listener
- The listener that should be added.
-
removeOnClearedListener
@MainThread void removeOnClearedListener(@NonNull RetainedLifecycle.OnClearedListener listener)
Removes aRetainedLifecycle.OnClearedListener
previously added viaaddOnClearedListener(OnClearedListener)
.- Parameters:
listener
- The listener that should be removed.
-
-