Register now for Android Dev Summit 2019!

SavedStateRegistryController

class SavedStateRegistryController
kotlin.Any
   ↳ androidx.savedstate.SavedStateRegistryController

An API for SavedStateRegistryOwner implementations to control SavedStateRegistry.

SavedStateRegistryOwner should call performRestore(Bundle) to restore state of SavedStateRegistry and performSave(Bundle) to gather SavedState from it.

Summary

Public methods

static SavedStateRegistryController

Creates a SavedStateRegistryController.

SavedStateRegistry

Returns controlled SavedStateRegistry

Unit
performRestore(@Nullable savedState: Bundle?)

An interface for an owner of this SavedStateRegistry to restore saved state.

Unit
performSave(@NonNull outBundle: Bundle)

An interface for an owner of this SavedStateRegistry to perform state saving, it will call all registered providers and merge with unconsumed state.

Public methods

create

@NonNull static fun create(@NonNull owner: SavedStateRegistryOwner): SavedStateRegistryController

Creates a SavedStateRegistryController.

It should be called during construction time of SavedStateRegistryOwner

getSavedStateRegistry

@NonNull fun getSavedStateRegistry(): SavedStateRegistry

Returns controlled SavedStateRegistry

performRestore

@MainThread fun performRestore(@Nullable savedState: Bundle?): Unit

An interface for an owner of this SavedStateRegistry to restore saved state.

Parameters
savedState Bundle?: restored state

performSave

@MainThread fun performSave(@NonNull outBundle: Bundle): Unit

An interface for an owner of this SavedStateRegistry to perform state saving, it will call all registered providers and merge with unconsumed state.

Parameters
outBundle Bundle: Bundle in which to place a saved state