SavedStateValue


public interface SavedStateValue<T extends Object> extends SavedStateRegistry.SavedStateProvider, SavedStateRegistry.SavedStateRestorer


Interface representing a saved state component holding a value.

A SavedStateValue combines state saving (SavedStateProvider) and restoration (SavedStateRestorer) with direct access to the underlying value.

Parameters
<T extends Object>

type of the underlying value

Summary

Public methods

abstract @NonNull T

The current value held by this saved state component.

Inherited methods

From androidx.savedstate.SavedStateRegistry.SavedStateProvider
abstract @NonNull SavedState

Called to retrieve the state from a component before it is killed so the state can be retrieved later from consumeRestoredStateForKey.

From androidx.savedstate.SavedStateRegistry.SavedStateRestorer
abstract void

Called to restore the state of a component.

Public methods

getValue

Added in 1.6.0-alpha05
abstract @NonNull T getValue()

The current value held by this saved state component.