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
final void

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

final void

Stores an IBinder value associated with the specified key in the IBinder.

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[] value)

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

final void
putChar(@NonNull String key, char value)

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

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

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

final void

Stores a char sequence value associated with the specified key in the SavedState.

final void
putCharSequenceArray(@NonNull String key, @NonNull CharSequence[] value)

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

final void

Stores a list of elements of CharSequence 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[] value)

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[] value)

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[] value)

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
<T extends Serializable> putJavaSerializable(@NonNull String key, @NonNull T value)

Stores an Serializable value associated with the specified key in the Serializable.

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[] value)

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> putParcelableArray(@NonNull String key, @NonNull T[] value)

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

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

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

final void
final void

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

final void
putSavedStateArray(@NonNull String key, @NonNull Bundle[] value)
final void
putSavedStateArray(@NonNull String key, @NonNull SavedState[] value)

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

final void
final void
putSavedStateList(
    @NonNull String key,
    @NonNull List<@NonNull SavedState> value
)

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

final void
putSize(@NonNull String key, @NonNull Size value)

Stores an Size value associated with the specified key in the Size.

final void

Stores an SizeF value associated with the specified key in the SizeF.

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

Stores a SparseArray of elements of Parcelable 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[] value)

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.1
public final void clear()

Removes all key-value pairs from the SavedState.

putAll

Added in 1.3.1
public final void putAll(@NonNull Bundle from)

putAll

public final void putAll(@NonNull SavedState from)

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

Parameters
@NonNull SavedState from

The SavedState containing the key-value pairs to add.

putBinder

Added in 1.3.1
public final void putBinder(@NonNull String key, @NonNull IBinder value)

Stores an IBinder value associated with the specified key in the IBinder.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull IBinder value

The IBinder value to store.

putBoolean

Added in 1.3.1
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.1
public final void putBooleanArray(@NonNull String key, @NonNull boolean[] value)

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[] value

The array of elements to store.

putChar

Added in 1.3.1
public final void putChar(@NonNull String key, char value)

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

Parameters
@NonNull String key

The key to associate the value with.

char value

The char value to store.

putCharArray

Added in 1.3.1
public final void putCharArray(@NonNull String key, @NonNull char[] value)

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[] value

The array of elements to store.

putCharSequence

Added in 1.3.1
public final void putCharSequence(@NonNull String key, @NonNull CharSequence value)

Stores a char sequence value associated with the specified key in the SavedState.

Parameters
@NonNull String key

The key to associate the value with.

@NonNull CharSequence value

The char sequence value to store.

putCharSequenceArray

Added in 1.3.1
public final void putCharSequenceArray(@NonNull String key, @NonNull CharSequence[] value)

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

Parameters
@NonNull String key

The key to associate the value with.

@NonNull CharSequence[] value

The array of elements to store.

putCharSequenceList

public final void putCharSequenceList(
    @NonNull String key,
    @NonNull List<@NonNull CharSequence> value
)

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

Parameters
@NonNull String key

The key to associate the value with.

@NonNull List<@NonNull CharSequence> value

The list of elements to store.

putDouble

Added in 1.3.1
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.1
public final void putDoubleArray(@NonNull String key, @NonNull double[] value)

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[] value

The array of elements to store.

putFloat

Added in 1.3.1
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.1
public final void putFloatArray(@NonNull String key, @NonNull float[] value)

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[] value

The array of elements to store.

putInt

Added in 1.3.1
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.1
public final void putIntArray(@NonNull String key, @NonNull int[] value)

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[] value

The array of elements to store.

putIntList

Added in 1.3.1
public final void putIntList(@NonNull String key, @NonNull List<@NonNull Integer> value)

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> value

The list of elements to store.

putJavaSerializable

Added in 1.3.1
public final void <T extends Serializable> putJavaSerializable(@NonNull String key, @NonNull T value)

Stores an Serializable value associated with the specified key in the Serializable.

Parameters
@NonNull String key

The key to associate the value with.