RetainedStateRegistry

Allows components to save and restore their state using the onRetainNonConfigurationInstance mechanism.

Inheritors

Types

Link copied to clipboard
interface Entry

The registry entry which you get when you use registerValue.

Functions

Link copied to clipboard
abstract fun consumeValue(key: String): Any?

Returns the restored value for the given key. Once being restored the value is cleared, so you can't restore the same key twice.

Link copied to clipboard
abstract fun forgetUnclaimedValues()

Releases all currently unconsumed values. Useful as a GC mechanism for the registry.

Link copied to clipboard

Registers the value provider.

Link copied to clipboard
abstract fun saveAll()

Executes all the registered value providers and combines these values into a map. We have a list of values for each key as it is allowed to have multiple providers for the same key.

Link copied to clipboard
abstract fun saveValue(key: String)

Executes the value providers registered with the given key, and saves them for retrieval.