SavedStateRegistryController
public final class SavedStateRegistryController
An API for SavedStateRegistryOwner implementations to control SavedStateRegistry.
SavedStateRegistryOwner should call performRestore to restore state of SavedStateRegistry and performSave to gather SavedState from it.
Summary
Public methods |
|
|---|---|
static final @NonNull SavedStateRegistryController |
create(@NonNull SavedStateRegistryOwner owner)Creates a |
final @NonNull SavedStateRegistry |
The |
final void |
Perform the initial, one time attachment necessary to configure this |
final void |
@MainThread |
final void |
@MainThreadAn interface for an owner of this |
final void |
@MainThread |
final void |
@MainThreadAn interface for an owner of this |
Public methods
create
public static final @NonNull SavedStateRegistryController create(@NonNull SavedStateRegistryOwner owner)
Creates a SavedStateRegistryController.
It should be called during construction time of SavedStateRegistryOwner
getSavedStateRegistry
public final @NonNull SavedStateRegistry getSavedStateRegistry()
The SavedStateRegistry owned by this controller
performAttach
@MainThread
public final void performAttach()
Perform the initial, one time attachment necessary to configure this SavedStateRegistry. This must be called when the owner's Lifecycle is Lifecycle.State.INITIALIZED and before you call performRestore.
performRestore
@MainThread
public final void performRestore(SavedState savedState)
An interface for an owner of this SavedStateRegistry to restore saved state.
| Parameters | |
|---|---|
SavedState savedState |
restored state |
performSave
@MainThread
public final void performSave(@NonNull SavedState outBundle)
An interface for an owner of this SavedStateRegistry to perform state saving, it will call all registered providers and merge with unconsumed state.
| Parameters | |
|---|---|
@NonNull SavedState outBundle |
SavedState in which to place a saved state |