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 |
clear()Removes all key-value pairs from the |
final void |
Stores all key-value pairs from the provided |
final void |
putAll(@NonNull SavedState from)Stores all key-value pairs from the provided |
final void |
Stores an |
final void |
putBoolean(@NonNull String key, boolean value)Stores a boolean value associated with the specified key in the |
final void |
putBooleanArray(@NonNull String key, @NonNull boolean[] value)Stores an |
final void |
Stores a char value associated with the specified key in the |
final void |
putCharArray(@NonNull String key, @NonNull char[] value)Stores an |
final void |
putCharSequence(@NonNull String key, @NonNull CharSequence value)Stores a char sequence value associated with the specified key in the |
final void |
putCharSequenceArray(@NonNull String key, @NonNull CharSequence[] value)Stores an |
final void |
putCharSequenceList(Stores a list of elements of |
final void |
Stores a double value associated with the specified key in the |
final void |
putDoubleArray(@NonNull String key, @NonNull double[] value)Stores an |
final void |
Stores a float value associated with the specified key in the |
final void |
putFloatArray(@NonNull String key, @NonNull float[] value)Stores an |
final void |
Stores an int value associated with the specified key in the |
final void |
putIntArray(@NonNull String key, @NonNull int[] value)Stores an |
final void |
Stores a list of elements of |
final void |
<T extends Serializable> putJavaSerializable(@NonNull String key, @NonNull T value)Stores an |
final void |
Stores an int value associated with the specified key in the |
final void |
putLongArray(@NonNull String key, @NonNull long[] value)Stores an |
final void |
Stores a null reference associated with the specified key in the |
final void |
<T extends Parcelable> putParcelable(@NonNull String key, @NonNull T value)Stores an |
final void |
<T extends Parcelable> putParcelableArray(@NonNull String key, @NonNull T[] value)Stores a |
final void |
<T extends Parcelable> putParcelableList(Stores a |
final void |
putSavedState(@NonNull String key, @NonNull Bundle value)Stores a |
final void |
putSavedState(@NonNull String key, @NonNull SavedState value)Stores a |
final void |
putSavedStateArray(@NonNull String key, @NonNull Bundle[] value)Stores an |
final void |
putSavedStateArray(@NonNull String key, @NonNull SavedState[] value)Stores an |
final void |
Stores a list of elements of |
final void |
putSavedStateList(Stores a list of elements of |
final void |
Stores an |
final void |
Stores an |
final void |
<T extends Parcelable> putSparseParcelableArray(Stores a |
final void |
Stores a string value associated with the specified key in the |
final void |
putStringArray(@NonNull String key, @NonNull String[] value)Stores an |
final void |
Stores a list of elements of |
final void |
Removes the value associated with the specified key from the |
Extension functions |
|
|---|---|
final void |
<T extends Object> SavedStateKt.putKotlinSerializable(Stores a |
final void |
<T extends Object> SavedStateKt.putKotlinSerializable(Stores a |
Public methods
putAll
public final void putAll(@NonNull Bundle from)
Stores all key-value pairs from the provided SavedState into this SavedState.
| Parameters | |
|---|---|
@NonNull Bundle from |
The |
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 |
putBinder
public final void putBinder(@NonNull String key, @NonNull IBinder value)
Stores an IBinder value associated with the specified key in the IBinder.
putBoolean
public final void putBoolean(@NonNull String key, boolean value)
Stores a boolean value associated with the specified key in the SavedState.
putBooleanArray
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.
putChar
public final void putChar(@NonNull String key, char value)
Stores a char value associated with the specified key in the SavedState.
putCharArray
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.
putCharSequence
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
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.
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.
putDouble
public final void putDouble(@NonNull String key, double value)
Stores a double value associated with the specified key in the SavedState.
putDoubleArray
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.
putFloat
public final void putFloat(@NonNull String key, float value)
Stores a float value associated with the specified key in the SavedState.
putFloatArray
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.
putInt
public final void putInt(@NonNull String key, int value)
Stores an int value associated with the specified key in the SavedState.
putIntArray
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.
putIntList
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.
putJavaSerializable
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. |
@NonNull T value |
The |
putLong
public final void putLong(@NonNull String key, long value)
Stores an int value associated with the specified key in the SavedState.
putLongArray
public final void putLongArray(@NonNull String key, @NonNull long[] value)
Stores an Array of elements of Long associated with the specified key in the SavedState.
putNull
public final void putNull(@NonNull String key)
Stores a null reference associated with the specified key in the SavedState.
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 |
putParcelableArray
public 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.
putParcelableList
public 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.
putSavedState
public final void putSavedState(@NonNull String key, @NonNull Bundle 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 Bundle value |
The |
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 |
putSavedStateArray
public final void putSavedStateArray(@NonNull String key, @NonNull Bundle[] value)
Stores an Array of elements of SavedState associated with the specified key in the SavedState.
putSavedStateArray
public final void putSavedStateArray(@NonNull String key, @NonNull SavedState[] value)
Stores an Array of elements of SavedState associated with the specified key in the SavedState.
putSavedStateList
public final void putSavedStateList(@NonNull String key, @NonNull List<@NonNull Bundle> value)
Stores a list of elements of SavedState associated with the specified key in the SavedState.
putSavedStateList
public 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.
putSize
public final void putSize(@NonNull String key, @NonNull Size value)
Stores an Size value associated with the specified key in the Size.
putSizeF
public final void putSizeF(@NonNull String key, @NonNull SizeF value)
Stores an SizeF value associated with the specified key in the SizeF.
putSparseParcelableArray
public 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.
| Parameters | |
|---|---|
@NonNull String key |
The key to associate the value with. |
@NonNull SparseArray<@NonNull T> value |
The |
putString
public final void putString(@NonNull String key, @NonNull String value)
Stores a string value associated with the specified key in the SavedState.
putStringArray
public final void putStringArray(@NonNull String key, @NonNull String[] value)
Stores an Array of elements of String associated with the specified key in the SavedState.
putStringList
public final void putStringList(@NonNull String key, @NonNull List<@NonNull String> value)
Stores a list of elements of String associated with the specified key in the SavedState.
Extension functions
SavedStateKt.putKotlinSerializable
public final void <T extends Object> SavedStateKt.putKotlinSerializable(
@NonNull SavedStateWriter receiver,
@NonNull String key,
@NonNull T value,
@NonNull SavedStateConfiguration configuration
)
Stores a kotlinx.serialization.Serializable value associated with the specified key in the SavedState.
| Parameters | |
|---|---|
@NonNull String key |
The key to associate the value with. |
@NonNull T value |
The |
@NonNull SavedStateConfiguration configuration |
The |
| See also | |
|---|---|
encodeToSavedState |
SavedStateKt.putKotlinSerializable
public final void <T extends Object> SavedStateKt.putKotlinSerializable(
@NonNull SavedStateWriter receiver,
@NonNull KSerializer<@NonNull T> serializer,
@NonNull String key,
@NonNull T value,
@NonNull SavedStateConfiguration configuration
)
Stores a kotlinx.serialization.Serializable value associated with the specified key in the SavedState.
| Parameters | |
|---|---|
@NonNull KSerializer<@NonNull T> serializer |
The |
@NonNull String key |
The key to associate the value with. |
@NonNull T value |
The |
@NonNull SavedStateConfiguration configuration |
The |
| See also | |
|---|---|
encodeToSavedState |