SavedStateRegistryController

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 functions

Unit

Perform the initial, one time attachment necessary to configure this SavedStateRegistry.

Unit

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

Unit

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

Public properties

SavedStateRegistry

The SavedStateRegistry owned by this controller

Public companion functions

create

Added in 1.2.0
fun create(owner: SavedStateRegistryOwner): SavedStateRegistryController

Creates a SavedStateRegistryController.

It should be called during construction time of SavedStateRegistryOwner

Public functions

performAttach

Added in 1.2.0
@MainThread
fun performAttach(): Unit

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

Added in 1.0.0
@MainThread
fun performRestore(savedState: Bundle?): Unit

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

Parameters
savedState: Bundle?

restored state

performSave

Added in 1.0.0
@MainThread
fun performSave(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

Public properties

savedStateRegistry

Added in 1.0.0
val savedStateRegistrySavedStateRegistry

The SavedStateRegistry owned by this controller