SavedStateWriter


value public final class SavedStateWriter


An inline class that encapsulates an opaque SavedState, and provides an API for writing the platform specific state.

See also
write

Summary

Public methods

final void

Removes all key-value pairs from the SavedState.

final void

Stores all key-value pairs from the provided SavedState into this SavedState.

final void
putBoolean(@NonNull String key, boolean value)

Stores a boolean value associated with the specified key in the SavedState.

final void
putBooleanArray(@NonNull String key, @NonNull boolean[] values)

Stores an Array of elements of Boolean associated with the specified key in the SavedState.

final void
putChar(@NonNull String key, char value)
final void
putCharArray(@NonNull String key, @NonNull char[] values)

Stores an Array of elements of Boolean associated with the specified key in the SavedState.

final void
putDouble(@NonNull String key, double value)

Stores a double value associated with the specified key in the SavedState.

final void
putDoubleArray(@NonNull String key, @NonNull double[] values)

Stores an Array of elements of Double associated with the specified key in the SavedState.

final void
putFloat(@NonNull String key, float value)

Stores a float value associated with the specified key in the SavedState.

final void
putFloatArray(@NonNull String key, @NonNull float[] values)

Stores an Array of elements of Float associated with the specified key in the SavedState.

final void
putInt(@NonNull String key, int value)

Stores an int value associated with the specified key in the SavedState.

final void
putIntArray(@NonNull String key, @NonNull int[] values)

Stores an Array of elements of Int associated with the specified key in the SavedState.

final void

Stores a list of elements of Int associated with the specified key in the SavedState.

final void
putLong(@NonNull String key, long value)

Stores an int value associated with the specified key in the SavedState.

final void
putLongArray(@NonNull String key, @NonNull long[] values)

Stores an Array of elements of Long associated with the specified key in the SavedState.

final void

Stores a null reference associated with the specified key in the SavedState.

final void
<T extends Parcelable> putParcelable(@NonNull String key, @NonNull T value)

Stores an Parcelable value associated with the specified key in the SavedState.

final void
<T extends Parcelable> putParcelableList(
    @NonNull String key,
    @NonNull List<@NonNull T> values
)

Stores a list of elements of Parcelable associated with the specified key in the SavedState.

final void

Stores a SavedState object associated with the specified key in the SavedState.

final void

Stores a string value associated with the specified key in the SavedState.

final void
putStringArray(@NonNull String key, @NonNull String[] values)

Stores an Array of elements of String associated with the specified key in the SavedState.

final void

Stores a list of elements of String associated with the specified key in the SavedState.

final void

Removes the value associated with the specified key from the SavedState.

Public methods

clear

Added in 1.3.0-alpha05
public final void clear()

Removes all key-value pairs from the SavedState.

putAll

public final void putAll(@NonNull SavedState values)

Stores all key-value pairs from the provided SavedState into this SavedState.

Parameters
@NonNull SavedState values

The SavedState containing the key-value pairs to add.

putBoolean

Added in 1.3.0-alpha05
public final void putBoolean(@NonNull String key, boolean value)

Stores a boolean value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

boolean value

The boolean value to store.

putBooleanArray

Added in 1.3.0-alpha05
public final void putBooleanArray(@NonNull String key, @NonNull boolean[] values)

Stores an Array of elements of Boolean associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull boolean[] values

The array of elements to store.

putChar

Added in 1.3.0-alpha05
public final void putChar(@NonNull String key, char value)

putCharArray

Added in 1.3.0-alpha05
public final void putCharArray(@NonNull String key, @NonNull char[] values)

Stores an Array of elements of Boolean associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull char[] values

The array of elements to store.

putDouble

Added in 1.3.0-alpha05
public final void putDouble(@NonNull String key, double value)

Stores a double value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

double value

The double value to store.

putDoubleArray

Added in 1.3.0-alpha05
public final void putDoubleArray(@NonNull String key, @NonNull double[] values)

Stores an Array of elements of Double associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull double[] values

The array of elements to store.

putFloat

Added in 1.3.0-alpha05
public final void putFloat(@NonNull String key, float value)

Stores a float value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

float value

The float value to store.

putFloatArray

Added in 1.3.0-alpha05
public final void putFloatArray(@NonNull String key, @NonNull float[] values)

Stores an Array of elements of Float associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull float[] values

The array of elements to store.

putInt

Added in 1.3.0-alpha05
public final void putInt(@NonNull String key, int value)

Stores an int value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

int value

The int value to store.

putIntArray

Added in 1.3.0-alpha05
public final void putIntArray(@NonNull String key, @NonNull int[] values)

Stores an Array of elements of Int associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull int[] values

The array of elements to store.

putIntList

Added in 1.3.0-alpha05
public final void putIntList(@NonNull String key, @NonNull List<@NonNull Integer> values)

Stores a list of elements of Int associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull List<@NonNull Integer> values

The list of elements to store.

putLong

Added in 1.3.0-alpha05
public final void putLong(@NonNull String key, long value)

Stores an int value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

long value

The Long value to store.

putLongArray

Added in 1.3.0-alpha05
public final void putLongArray(@NonNull String key, @NonNull long[] values)

Stores an Array of elements of Long associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull long[] values

The array of elements to store.

putNull

Added in 1.3.0-alpha05
public final void putNull(@NonNull String key)

Stores a null reference associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the null reference.

putParcelable

public final void <T extends Parcelable> putParcelable(@NonNull String key, @NonNull T value)

Stores an Parcelable value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull T value

The Parcelable value to store.

putParcelableList

public final void <T extends Parcelable> putParcelableList(
    @NonNull String key,
    @NonNull List<@NonNull T> values
)

Stores a list of elements of Parcelable associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull List<@NonNull T> values

The list of elements to store.

putSavedState

public final void putSavedState(@NonNull String key, @NonNull SavedState value)

Stores a SavedState object associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull SavedState value

The SavedState object to store

putString

Added in 1.3.0-alpha05
public final void putString(@NonNull String key, @NonNull String value)

Stores a string value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull String value

The string value to store.

putStringArray

Added in 1.3.0-alpha05
public final void putStringArray(@NonNull String key, @NonNull String[] values)

Stores an Array of elements of String associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull String[] values

The array of elements to store.

putStringList

Added in 1.3.0-alpha05
public final void putStringList(@NonNull String key, @NonNull List<@NonNull String> values)

Stores a list of elements of String associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull List<@NonNull String> values

The list of elements to store.

remove

Added in 1.3.0-alpha05
public final void remove(@NonNull String key)

Removes the value associated with the specified key from the SavedState.

Parameters
@NonNull String key

The key to remove.