SavedStateReader
-
Cmn
value class SavedStateReader
An inline class that encapsulates an opaque SavedState, and provides an API for reading the platform specific state.
| See also | |
|---|---|
read |
Summary
Public functions |
||
|---|---|---|
operator Boolean |
Checks if the |
Cmn
android
|
Boolean |
contentDeepEquals(other: Bundle) |
android
|
Boolean |
contentDeepEquals(other: SavedState)Checks if the two specified |
Cmn
android
|
Int |
Returns a hash code based on the "deep contents" of specified |
Cmn
android
|
String |
Returns a string representation of the contents of this |
Cmn
android
|
IBinder |
Retrieves an |
android
|
IBinder? |
getBinderOrNull(key: String)Retrieves a |
android
|
Boolean |
getBoolean(key: String)Retrieves a |
Cmn
android
|
BooleanArray |
getBooleanArray(key: String)Retrieves a |
Cmn
android
|
BooleanArray? |
getBooleanArrayOrNull(key: String)Retrieves a |
Cmn
android
|
Boolean? |
getBooleanOrNull(key: String)Retrieves a |
Cmn
android
|
Char |
Retrieves a |
Cmn
android
|
CharArray |
getCharArray(key: String)Retrieves a |
Cmn
android
|
CharArray? |
getCharArrayOrNull(key: String)Retrieves a |
Cmn
android
|
Char? |
getCharOrNull(key: String)Retrieves a |
Cmn
android
|
CharSequence |
getCharSequence(key: String)Retrieves a |
Cmn
android
|
Array<CharSequence> |
getCharSequenceArray(key: String)Retrieves an |
Cmn
android
|
Array<CharSequence>? |
Retrieves an |
Cmn
android
|
List<CharSequence> |
getCharSequenceList(key: String)Retrieves a |
Cmn
android
|
List<CharSequence>? |
Retrieves a |
Cmn
android
|
CharSequence? |
getCharSequenceOrNull(key: String)Retrieves a |
Cmn
android
|
Double |
Retrieves a |
Cmn
android
|
DoubleArray |
getDoubleArray(key: String)Retrieves a |
Cmn
android
|
DoubleArray? |
getDoubleArrayOrNull(key: String)Retrieves a |
Cmn
android
|
Double? |
getDoubleOrNull(key: String)Retrieves a |
Cmn
android
|
Float |
Retrieves a |
Cmn
android
|
FloatArray |
getFloatArray(key: String)Retrieves a |
Cmn
android
|
FloatArray? |
getFloatArrayOrNull(key: String)Retrieves a |
Cmn
android
|
Float? |
getFloatOrNull(key: String)Retrieves a |
Cmn
android
|
Int |
Retrieves an |
Cmn
android
|
IntArray |
getIntArray(key: String)Retrieves a |
Cmn
android
|
IntArray? |
getIntArrayOrNull(key: String)Retrieves a |
Cmn
android
|
List<Int> |
getIntList(key: String)Retrieves a |
Cmn
android
|
List<Int>? |
getIntListOrNull(key: String)Retrieves a |
Cmn
android
|
Int? |
getIntOrNull(key: String)Retrieves an |
Cmn
android
|
inline T |
<T : Serializable> getJavaSerializable(key: String)Retrieves a |
android
|
T |
<T : Serializable> getJavaSerializable(Retrieves a |
android
|
inline T? |
<T : Serializable> getJavaSerializableOrNull(key: String)Retrieves a |
android
|
T? |
<T : Serializable> getJavaSerializableOrNull(Retrieves a |
android
|
Long |
Retrieves a |
Cmn
android
|
LongArray |
getLongArray(key: String)Retrieves a |
Cmn
android
|
LongArray? |
getLongArrayOrNull(key: String)Retrieves a |
Cmn
android
|
Long? |
getLongOrNull(key: String)Retrieves a |
Cmn
android
|
inline T |
<T : Parcelable> getParcelable(key: String)Retrieves a |
android
|
T |
<T : Parcelable> getParcelable(key: String, parcelableClass: KClass<T>)Retrieves a |
android
|
inline Array<T> |
<T : Parcelable> getParcelableArray(key: String)Retrieves an |
android
|
Array<T> |
<T : Parcelable> getParcelableArray(key: String, parcelableClass: KClass<T>)Retrieves an |
android
|
inline Array<T>? |
<T : Parcelable> getParcelableArrayOrNull(key: String)Retrieves an |
android
|
Array<T>? |
<T : Parcelable> getParcelableArrayOrNull(Retrieves an |
android
|
inline List<T> |
<T : Parcelable> getParcelableList(key: String)Retrieves a |
android
|
List<T> |
<T : Parcelable> getParcelableList(key: String, parcelableClass: KClass<T>)Retrieves a |
android
|
inline List<T>? |
<T : Parcelable> getParcelableListOrNull(key: String)Retrieves a |
android
|
List<T>? |
<T : Parcelable> getParcelableListOrNull(Retrieves a |
android
|
inline T? |
<T : Parcelable> getParcelableOrNull(key: String)Retrieves a |
android
|
T? |
<T : Parcelable> getParcelableOrNull(key: String, parcelableClass: KClass<T>)Retrieves a |
android
|
SavedState |
getSavedState(key: String)Retrieves a |
Cmn
android
|
Array<SavedState> |
getSavedStateArray(key: String)Retrieves an |
Cmn
android
|
Array<SavedState>? |
Retrieves an |
Cmn
android
|
List<SavedState> |
getSavedStateList(key: String)Retrieves a |
Cmn
android
|
List<SavedState>? |
Retrieves a |
Cmn
android
|
SavedState? |
getSavedStateOrNull(key: String)Retrieves a |
Cmn
android
|
Size |
Retrieves a |
android
|
SizeF |
Retrieves a |
android
|
SizeF? |
getSizeFOrNull(key: String)Retrieves a |
android
|
Size? |
getSizeOrNull(key: String)Retrieves a |
android
|
inline SparseArray<T> |
<T : Parcelable> getSparseParcelableArray(key: String)Retrieves a |
android
|
SparseArray<T> |
<T : Parcelable> getSparseParcelableArray(Retrieves a |
android
|
inline SparseArray<T>? |
<T : Parcelable> getSparseParcelableArrayOrNull(key: String)Retrieves a |
android
|
SparseArray<T>? |
<T : Parcelable> getSparseParcelableArrayOrNull(Retrieves a |
android
|
String |
Retrieves a |
Cmn
android
|
Array<String> |
getStringArray(key: String)Retrieves an |
Cmn
android
|
Array<String>? |
getStringArrayOrNull(key: String)Retrieves an |
Cmn
android
|
List<String> |
getStringList(key: String)Retrieves a |
Cmn
android
|
List<String>? |
getStringListOrNull(key: String)Retrieves a |
Cmn
android
|
String? |
getStringOrNull(key: String)Retrieves a |
Cmn
android
|
Boolean |
isEmpty()Checks if the |
Cmn
android
|
Boolean |
Checks if the |
Cmn
android
|
Int |
size()Returns the number of key-value pairs in the |
Cmn
android
|
Map<String, Any?> |
toMap()Returns a new |
Cmn
android
|
Public functions
contains
operator fun contains(key: String): Boolean
Checks if the SavedState contains the specified key.
| Returns | |
|---|---|
Boolean |
|
contentDeepEquals
fun contentDeepEquals(other: SavedState): Boolean
Checks if the two specified SavedState are deeply equal to one another.
Two SavedState are considered deeply equal if they have the same size, and elements at corresponding keys are deeply equal. That is, if two corresponding elements are nested SavedState, they are also compared deeply.
If any of SavedState contains itself on any nesting level the behavior is undefined.
| Parameters | |
|---|---|
other: SavedState |
the object to compare deeply with this. |
| Returns | |
|---|---|
Boolean |
|
contentDeepHashCode
fun contentDeepHashCode(): Int
Returns a hash code based on the "deep contents" of specified SavedState. If the SavedState contains other SavedState as elements, the hash code is based on their contents and so on.
The computation of the hash code returned is as if the SavedState is a List. Nested SavedState are treated as lists too.
If any of SavedState contains itself on any nesting level the behavior is undefined.
| Returns | |
|---|---|
Int |
a deep-content-based hash code for |
contentDeepToString
fun contentDeepToString(): String
Returns a string representation of the contents of this SavedState as if it is a List. Nested SavedState are treated as lists too.
If any of SavedState contains itself on any nesting level that reference is rendered as "[...]" to prevent recursion.
getBinder
fun getBinder(key: String): IBinder
Retrieves an IBinder value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getBinderOrNull
fun getBinderOrNull(key: String): IBinder?
Retrieves a IBinder value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getBoolean
fun getBoolean(key: String): Boolean
Retrieves a Boolean value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getBooleanArray
fun getBooleanArray(key: String): BooleanArray
Retrieves a BooleanArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
BooleanArray |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getBooleanArrayOrNull
fun getBooleanArrayOrNull(key: String): BooleanArray?
Retrieves a BooleanArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
BooleanArray? |
The value associated with the |
getBooleanOrNull
fun getBooleanOrNull(key: String): Boolean?
Retrieves a Boolean value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getChar
fun getChar(key: String): Char
Retrieves a Char value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getCharArray
fun getCharArray(key: String): CharArray
Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getCharArrayOrNull
fun getCharArrayOrNull(key: String): CharArray?
Retrieves a CharArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getCharOrNull
fun getCharOrNull(key: String): Char?
Retrieves a Char value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getCharSequence
fun getCharSequence(key: String): CharSequence
Retrieves a CharSequence value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
CharSequence |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getCharSequenceArray
fun getCharSequenceArray(key: String): Array<CharSequence>
Retrieves an Array of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
Array<CharSequence> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getCharSequenceArrayOrNull
fun getCharSequenceArrayOrNull(key: String): Array<CharSequence>?
Retrieves an Array of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
Array<CharSequence>? |
The values associated with the |
getCharSequenceList
fun getCharSequenceList(key: String): List<CharSequence>
Retrieves a List of CharSequence values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
List<CharSequence> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getCharSequenceListOrNull
fun getCharSequenceListOrNull(key: String): List<CharSequence>?
Retrieves a List of CharSequence values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
List<CharSequence>? |
The values associated with the |
getCharSequenceOrNull
fun getCharSequenceOrNull(key: String): CharSequence?
Retrieves a CharSequence value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
| Returns | |
|---|---|
CharSequence? |
The value associated with the |
getDouble
fun getDouble(key: String): Double
Retrieves a Double value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getDoubleArray
fun getDoubleArray(key: String): DoubleArray
Retrieves a DoubleArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
DoubleArray |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getDoubleArrayOrNull
fun getDoubleArrayOrNull(key: String): DoubleArray?
Retrieves a DoubleArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
DoubleArray? |
The value associated with the |
getDoubleOrNull
fun getDoubleOrNull(key: String): Double?
Retrieves a Double value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getFloat
fun getFloat(key: String): Float
Retrieves a Float value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getFloatArray
fun getFloatArray(key: String): FloatArray
Retrieves a FloatArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
FloatArray |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getFloatArrayOrNull
fun getFloatArrayOrNull(key: String): FloatArray?
Retrieves a FloatArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
FloatArray? |
The value associated with the |
getFloatOrNull
fun getFloatOrNull(key: String): Float?
Retrieves a Float value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getInt
fun getInt(key: String): Int
Retrieves an Int value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getIntArray
fun getIntArray(key: String): IntArray
Retrieves a IntArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getIntArrayOrNull
fun getIntArrayOrNull(key: String): IntArray?
Retrieves a IntArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getIntList
fun getIntList(key: String): List<Int>
Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getIntListOrNull
fun getIntListOrNull(key: String): List<Int>?
Retrieves a List of Int values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getIntOrNull
fun getIntOrNull(key: String): Int?
Retrieves an Int value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getJavaSerializable
inline fun <T : Serializable> getJavaSerializable(key: String): T
Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Serializable> |
The expected type of the value. |
key: String |
The |
| Returns | |
|---|---|
T |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getJavaSerializable
fun <T : Serializable> getJavaSerializable(
key: String,
serializableClass: KClass<T>
): T
Retrieves a Serializable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
serializableClass: KClass<T> |
The expected type of the value. |
| Returns | |
|---|---|
T |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getJavaSerializableOrNull
inline fun <T : Serializable> getJavaSerializableOrNull(key: String): T?
Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Serializable> |
The expected type of the value. |
key: String |
The |
| Returns | |
|---|---|
T? |
The value associated with the |
getJavaSerializableOrNull
fun <T : Serializable> getJavaSerializableOrNull(
key: String,
serializableClass: KClass<T>
): T?
Retrieves a Serializable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
serializableClass: KClass<T> |
The expected type of the value. |
| Returns | |
|---|---|
T? |
The value associated with the |
getLong
fun getLong(key: String): Long
Retrieves a Long value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getLongArray
fun getLongArray(key: String): LongArray
Retrieves a LongArray value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getLongArrayOrNull
fun getLongArrayOrNull(key: String): LongArray?
Retrieves a LongArray value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getLongOrNull
fun getLongOrNull(key: String): Long?
Retrieves a Long value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
Note: This method returns a nullable primitive, causing auto-boxing on JVM targets.
getParcelable
inline fun <T : Parcelable> getParcelable(key: String): T
Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the value. |
key: String |
The |
| Returns | |
|---|---|
T |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelable
fun <T : Parcelable> getParcelable(key: String, parcelableClass: KClass<T>): T
Retrieves a Parcelable value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the value. |
| Returns | |
|---|---|
T |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelableArray
inline fun <T : Parcelable> getParcelableArray(key: String): Array<T>
Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelableArray
fun <T : Parcelable> getParcelableArray(key: String, parcelableClass: KClass<T>): Array<T>
Retrieves an Array of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the values. |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelableArrayOrNull
inline fun <T : Parcelable> getParcelableArrayOrNull(key: String): Array<T>?
Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
getParcelableArrayOrNull
fun <T : Parcelable> getParcelableArrayOrNull(
key: String,
parcelableClass: KClass<T>
): Array<T>?
Retrieves an Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getParcelableList
inline fun <T : Parcelable> getParcelableList(key: String): List<T>
Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelableList
fun <T : Parcelable> getParcelableList(key: String, parcelableClass: KClass<T>): List<T>
Retrieves a List of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the values. |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getParcelableListOrNull
inline fun <T : Parcelable> getParcelableListOrNull(key: String): List<T>?
Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
getParcelableListOrNull
fun <T : Parcelable> getParcelableListOrNull(
key: String,
parcelableClass: KClass<T>
): List<T>?
Retrieves a List of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getParcelableOrNull
inline fun <T : Parcelable> getParcelableOrNull(key: String): T?
Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the value. |
key: String |
The |
| Returns | |
|---|---|
T? |
The value associated with the |
getParcelableOrNull
fun <T : Parcelable> getParcelableOrNull(key: String, parcelableClass: KClass<T>): T?
Retrieves a Parcelable value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the value. |
| Returns | |
|---|---|
T? |
The value associated with the |
getSavedState
fun getSavedState(key: String): SavedState
Retrieves a SavedState value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
SavedState |
The value associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSavedStateArray
fun getSavedStateArray(key: String): Array<SavedState>
Retrieves an Array of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
Array<SavedState> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSavedStateArrayOrNull
fun getSavedStateArrayOrNull(key: String): Array<SavedState>?
Retrieves an Array of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
Array<SavedState>? |
The values associated with the |
getSavedStateList
fun getSavedStateList(key: String): List<SavedState>
Retrieves a List of SavedState values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
List<SavedState> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSavedStateListOrNull
fun getSavedStateListOrNull(key: String): List<SavedState>?
Retrieves a List of SavedState values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
List<SavedState>? |
The values associated with the |
getSavedStateOrNull
fun getSavedStateOrNull(key: String): SavedState?
Retrieves a SavedState value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Returns | |
|---|---|
SavedState? |
The value associated with the |
getSize
fun getSize(key: String): Size
Retrieves a Size value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSizeF
fun getSizeF(key: String): SizeF
Retrieves a SizeF value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSizeFOrNull
fun getSizeFOrNull(key: String): SizeF?
Retrieves a SizeF value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getSizeOrNull
fun getSizeOrNull(key: String): Size?
Retrieves a Size value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getSparseParcelableArray
inline fun <T : Parcelable> getSparseParcelableArray(key: String): SparseArray<T>
Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
| Returns | |
|---|---|
SparseArray<T> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSparseParcelableArray
fun <T : Parcelable> getSparseParcelableArray(
key: String,
parcelableClass: KClass<T>
): SparseArray<T>
Retrieves a SparseArray of Parcelable values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the values. |
| Returns | |
|---|---|
SparseArray<T> |
The values associated with the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getSparseParcelableArrayOrNull
inline fun <T : Parcelable> getSparseParcelableArrayOrNull(key: String): SparseArray<T>?
Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
<T : Parcelable> |
The expected type of the values. |
key: String |
The |
| Returns | |
|---|---|
SparseArray<T>? |
The values associated with the |
getSparseParcelableArrayOrNull
fun <T : Parcelable> getSparseParcelableArrayOrNull(
key: String,
parcelableClass: KClass<T>
): SparseArray<T>?
Retrieves a Array of Parcelable values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Parameters | |
|---|---|
key: String |
The |
parcelableClass: KClass<T> |
The expected type of the values. |
| Returns | |
|---|---|
SparseArray<T>? |
The values associated with the |
getString
fun getString(key: String): String
Retrieves a String value associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getStringArray
fun getStringArray(key: String): Array<String>
Retrieves an Array of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getStringArrayOrNull
fun getStringArrayOrNull(key: String): Array<String>?
Retrieves an Array of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getStringList
fun getStringList(key: String): List<String>
Retrieves a List of String values associated with the specified key, or throws an IllegalArgumentException if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
If the |
kotlin.IllegalArgumentException |
If associated value is |
kotlin.IllegalArgumentException |
if associated value has wrong type. |
getStringListOrNull
fun getStringListOrNull(key: String): List<String>?
Retrieves a List of String values associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
getStringOrNull
fun getStringOrNull(key: String): String?
Retrieves a String value associated with the specified key, or null if this SavedState does not contain a valid value for the key.
More specifically, a SavedState is considered to contain a valid value for a key if the key exists, the associated value is not null, and it is of the expected type.
isEmpty
fun isEmpty(): Boolean
Checks if the SavedState is empty (contains no key-value pairs).
| Returns | |
|---|---|
Boolean |
|
isNull
fun isNull(key: String): Boolean
Checks if the SavedState contains a null reference for the specified key.
| Returns | |
|---|---|
Boolean |
|
size
fun size(): Int
Returns the number of key-value pairs in the SavedState.
| Returns | |
|---|---|
Int |
The size of the |
toMap
fun toMap(): Map<String, Any?>
Returns a new Map containing all key-value pairs from the SavedState.
The returned Map does not preserve the entry iteration order of the SavedState.
IMPORTANT: All values will be copied by reference, and values within the SavedState that are also a SavedState will NOT be converted to a Map.
| Returns | |
|---|---|
Map<String, Any?> |
A |