Google is committed to advancing racial equity for Black communities. See how.

Savedstate

Write pluggable components that save the UI state when a process dies, and restore it when the process restarts.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
May 20, 2020 1.0.0 - - 1.1.0-alpha01

Declaring dependencies

To add a dependency on SavedState, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    // Java language implementation
    implementation "androidx.savedstate:savedstate:1.0.0"

    // Kotlin
    implementation "androidx.savedstate:savedstate-ktx:1.1.0-alpha01"
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.1.0

Version 1.1.0-alpha01

May 20, 2020

androidx.savedstate:savedstate:1.1.0-alpha01 and androidx.savedstate:savedstate-ktx:1.1.0-alpha01 are released. Version 1.1.0-alpha01 contains these commits.

New Features

Version 1.0.0

Version 1.0.0

September 5, 2019

androidx.savedstate:savedstate:1.0.0 is released. The commits included in this version can be found here.

Major features of SavedState 1.0.0

androidx.savedstate graduated to a stable release. This is a set of APIs that allow developers to plugin components into the restore / saveInstanceState process. The main entry point of the API is SavedStateRegistry, which provides a way to retrieve previously saved states using consumeRestoredStateForKey and register a callback to registerSavedStateProvider to provide a saved state once system requests it.

Version 1.0.0-rc01

July 2, 2019

androidx.savedstate:savedstate:1.0.0-rc01 is released. The commits included in this version can be found here.

Bug fixes

Version 1.0.0-beta01

May 7, 2019

androidx.savedstate:savedstate:1.0.0-beta01 is released. The commits included in this version can be found here.

Version 1.0.0-alpha02

March 13, 2019

androidx.savedstate:savedstate:1.0.0-alpha02 is released. androidx.savedstate:savedstate combines artifacts androidx.savedstate:savedstate-bundle and androidx.savedstate:savedstate-common into one artifact, because it was decided to simplify savedstate infrastructure and remove generics from SavedStateRegistry. Thus, there is no need for separate modules.

The full list of commits included in this version can be found here.

New features

  • SavedStateRegistry.runOnNextRecreaction(Class<? extends AutoRecreated> clazz ) was added. The given class will be instantiated and the method AutoRecreated.onRecreated will be run when the owning component restarted.

API changes

  • Generics removed from SavedStateRegistry<T>
  • AbstractSavedStateRegistry & BundlableSavedStateRegistry are removed, use simple SavedStateRegistry instead
  • BundleSavedStateRegistryOwner is renamed to SavedStateRegistryOwner

Version 1.0.0-alpha01

December 17, 2018

This is the first release of SavedState.

New features

androidx.savedstate is a new set of alpha APIs that allow developers to plugin components to the restore / saveInstanceState process. The main entry point of the API is SavedStateRegistry<T>, which provides a way to retrieve previously savedstate via consumeRestoredStateForKey and register a callback to registerSavedStateProvider to provide a savedstate once system requests it.