Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

SavedStateProvider

interface SavedStateProvider
androidx.savedstate.SavedStateRegistry.SavedStateProvider

This interface marks a component that contributes to saved state.

Summary

Public methods

abstract Bundle

Called to retrieve a state from a component before being killed so later the state can be received from consumeRestoredStateForKey(String)

Public methods

saveState

@NonNull abstract fun saveState(): Bundle

Called to retrieve a state from a component before being killed so later the state can be received from consumeRestoredStateForKey(String)

Return
Bundle: S with your saved state.