# ParcelCompat

# ParcelCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/os/ParcelCompat.java+class:androidx.core.os.ParcelCompat)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/os/ParcelCompat "View this page in Java")

<br />

```
class ParcelCompat
```

<br />

*** ** * ** ***

Helper for accessing features in[Parcel](https://developer.android.com/reference/android/os/Parcel.html).

## Summary

|                                                                                                 ### Public functions                                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!>?`                                      | `<T> `[readArray](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readArray(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?, clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>)` Same as[readArray](https://developer.android.com/reference/android/os/Parcel.html#readArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `java-static `[ArrayList](https://developer.android.com/reference/java/util/ArrayList.html)`<T!>?`                                                                                                                    | `<T> `[readArrayList](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readArrayList(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<? extends T>))`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?, clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>)` Same as[readArrayList](https://developer.android.com/reference/android/os/Parcel.html#readArrayList(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                     | [readBoolean](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readBoolean(android.os.Parcel))`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`)` Read a boolean value from the parcel at the current[dataPosition](https://developer.android.com/reference/android/os/Parcel.html#dataPosition()).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `java-static `[HashMap](https://developer.android.com/reference/java/util/HashMap.html)`<K!, V!>?`                                                                                                                    | `<K, V> `[readHashMap](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readHashMap(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<? extends K>,java.lang.Class<? extends V>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazzKey: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<K!>,` ` clazzValue: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<V!>` `)` Same as[readHashMap](https://developer.android.com/reference/android/os/Parcel.html#readHashMap(java.lang.ClassLoader))but accepts`clazzKey`and`clazzValue`parameter as the types required for each key and value pair.                                                                                                                                                                                                                                                                                                                               |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                           | `<T> `[readList](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readList(android.os.Parcel,java.util.List<? super T>,java.lang.ClassLoader,java.lang.Class<T>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` outVal: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<T!>,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>` `)` Same as[readList](https://developer.android.com/reference/android/os/Parcel.html#readList(java.util.List, java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                       |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                           | `<K, V> `[readMap](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readMap(android.os.Parcel,java.util.Map<? super K,? super V>,java.lang.ClassLoader,java.lang.Class<K>,java.lang.Class<V>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` outVal: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)`)`[Map](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html)`<K!, V!>,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazzKey: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<K!>,` ` clazzValue: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<V!>` `)` Same as[readMap](https://developer.android.com/reference/android/os/Parcel.html#readMap(java.util.Map, java.lang.ClassLoader))but accepts`clazzKey`and`clazzValue`parameter as the types required for each key and value pair.                                                                                            |
| `java-static T?`                                                                                                                                                                                                      | `<T : `[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)`?> `[readParcelable](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelable(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>` `)` Same as[readParcelable](https://developer.android.com/reference/android/os/Parcel.html#readParcelable(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                                                                                                                                                                       |
| `java-static `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<T!>?`                                                                                                                  | `<T> `~~[readParcelableArray](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableArray(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))~~`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?, clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>)` **This function is deprecated.** This method incurs a performance penalty on SDK 33 and below. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)`!>?`                                 | `<T> `[readParcelableArrayTyped](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableArrayTyped(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>` `)` Same as[readParcelableArray](https://developer.android.com/reference/android/os/Parcel.html#readParcelableArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `java-static `[Parcelable.Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html)`<T!>?`                                                                                                 | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 30)` `<T> `[readParcelableCreator](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableCreator(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?, clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>)` Same as[readParcelableCreator](https://developer.android.com/reference/android/os/Parcel.html#readParcelableCreator(java.lang.ClassLoader))but accepts`clazz`parameter as the required type.                                                                                                                                                                                                                                                                                                                                                                             |
| `java-static (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<T!>` | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(api = `[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#Q)`)` `<T> `[readParcelableList](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableList(android.os.Parcel,java.util.List<T>,java.lang.ClassLoader,java.lang.Class<T>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` list: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<T!>,` ` cl: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>` `)` Same as[readParcelableList](https://developer.android.com/reference/android/os/Parcel.html#readParcelableList(java.util.List&lt;T&gt;, java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. |
| `java-static T?`                                                                                                                                                                                                      | `<T : `[Serializable](https://developer.android.com/reference/java/io/Serializable.html)`?> `[readSerializable](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readSerializable(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))`(` ` in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`,` ` loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?,` ` clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>` `)` Same as[readSerializable](https://developer.android.com/reference/android/os/Parcel.html#readSerializable())but accepts`loader`parameter as the primary classLoader for resolving the Serializable class; and`clazz`parameter as the required type.                                                                                                                                                                                                                                                                                                                                           |
| `java-static `[SparseArray](https://developer.android.com/reference/android/util/SparseArray.html)`<T!>?`                                                                                                             | `<T> `[readSparseArray](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readSparseArray(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<? extends T>))`(in: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, loader: `[ClassLoader](https://developer.android.com/reference/java/lang/ClassLoader.html)`?, clazz: `[Class](https://developer.android.com/reference/java/lang/Class.html)`<T!>)` Same as[readSparseArray](https://developer.android.com/reference/android/os/Parcel.html#readSparseArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                           | [writeBoolean](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#writeBoolean(android.os.Parcel,boolean))`(out: `[Parcel](https://developer.android.com/reference/android/os/Parcel.html)`, value: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Write a boolean value into the parcel at the current f[dataPosition](https://developer.android.com/reference/android/os/Parcel.html#dataPosition()), growing[dataCapacity](https://developer.android.com/reference/android/os/Parcel.html#dataCapacity())if needed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

## Public functions

### readArray

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T> readArray(in: Parcel, loader: ClassLoader?, clazz: Class<T!>): Array<Any!>?
```

Same as[readArray](https://developer.android.com/reference/android/os/Parcel.html#readArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the array elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readArrayList

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T> readArrayList(in: Parcel, loader: ClassLoader?, clazz: Class<T!>): ArrayList<T!>?
```

Same as[readArrayList](https://developer.android.com/reference/android/os/Parcel.html#readArrayList(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the list elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readBoolean

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun readBoolean(in: Parcel): Boolean
```

Read a boolean value from the parcel at the current[dataPosition](https://developer.android.com/reference/android/os/Parcel.html#dataPosition()).  

### readHashMap

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <K, V> readHashMap(
    in: Parcel,
    loader: ClassLoader?,
    clazzKey: Class<K!>,
    clazzValue: Class<V!>
): HashMap<K!, V!>?
```

Same as[readHashMap](https://developer.android.com/reference/android/os/Parcel.html#readHashMap(java.lang.ClassLoader))but accepts`clazzKey`and`clazzValue`parameter as the types required for each key and value pair. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the map entries' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | if the item to be deserialized is not an instance of that class or any of its children class. |

### readList

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T> readList(
    in: Parcel,
    outVal: (Mutable)List<T!>,
    loader: ClassLoader?,
    clazz: Class<T!>
): Unit
```

Same as[readList](https://developer.android.com/reference/android/os/Parcel.html#readList(java.util.List, java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the list elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readMap

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <K, V> readMap(
    in: Parcel,
    outVal: (Mutable)Map<K!, V!>,
    loader: ClassLoader?,
    clazzKey: Class<K!>,
    clazzValue: Class<V!>
): Unit
```

Same as[readMap](https://developer.android.com/reference/android/os/Parcel.html#readMap(java.util.Map, java.lang.ClassLoader))but accepts`clazzKey`and`clazzValue`parameter as the types required for each key and value pair. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the map entries' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | If the item to be deserialized is not an instance of that class or any of its children class. |

### readParcelable

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T : Parcelable?> readParcelable(
    in: Parcel,
    loader: ClassLoader?,
    clazz: Class<T!>
): T?
```

Same as[readParcelable](https://developer.android.com/reference/android/os/Parcel.html#readParcelable(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, the object type is checked after deserialization.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readParcelableArray

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  
Deprecated in[1.10.0](https://developer.android.com/jetpack/androidx/releases/core#1.10.0)  

```
java-static fun <T> [readParcelableArray](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableArray(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))(in: Parcel, loader: ClassLoader?, clazz: Class<T!>): Array<T!>?
```
| **This function is deprecated.**   
|
| This method incurs a performance penalty on SDK 33 and below. Use[readParcelableArrayTyped](https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat#readParcelableArrayTyped(android.os.Parcel,java.lang.ClassLoader,java.lang.Class<T>))instead.

Same as[readParcelableArray](https://developer.android.com/reference/android/os/Parcel.html#readParcelableArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the array elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readParcelableArrayTyped

Added in[1.10.0](https://developer.android.com/jetpack/androidx/releases/core#1.10.0)  

```
java-static fun <T> readParcelableArrayTyped(
    in: Parcel,
    loader: ClassLoader?,
    clazz: Class<T!>
): Array<Parcelable!>?
```

Same as[readParcelableArray](https://developer.android.com/reference/android/os/Parcel.html#readParcelableArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the array elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readParcelableCreator

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
@RequiresApi(value = 30)
java-static fun <T> readParcelableCreator(in: Parcel, loader: ClassLoader?, clazz: Class<T!>): Parcelable.Creator<T!>?
```

Same as[readParcelableCreator](https://developer.android.com/reference/android/os/Parcel.html#readParcelableCreator(java.lang.ClassLoader))but accepts`clazz`parameter as the required type. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the creator's type.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there there was an error trying to read the[Parcelable.Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html). |

### readParcelableList

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
@RequiresApi(api = Build.VERSION_CODES.Q)
java-static fun <T> readParcelableList(
    in: Parcel,
    list: (Mutable)List<T!>,
    cl: ClassLoader?,
    clazz: Class<T!>
): (Mutable)List<T!>
```

Same as[readParcelableList](https://developer.android.com/reference/android/os/Parcel.html#readParcelableList(java.util.List&lt;T&gt;, java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the list elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### readSerializable

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T : Serializable?> readSerializable(
    in: Parcel,
    loader: ClassLoader?,
    clazz: Class<T!>
): T?
```

Same as[readSerializable](https://developer.android.com/reference/android/os/Parcel.html#readSerializable())but accepts`loader`parameter as the primary classLoader for resolving the Serializable class; and`clazz`parameter as the required type. Compatibility behavior:

- SDK 33 and later, this method matches platform behavior.
- SDK 32 and below, this method will not check the item's type.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children class or there there was an error deserializing the object. |

### readSparseArray

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
java-static fun <T> readSparseArray(in: Parcel, loader: ClassLoader?, clazz: Class<T!>): SparseArray<T!>?
```

Same as[readSparseArray](https://developer.android.com/reference/android/os/Parcel.html#readSparseArray(java.lang.ClassLoader))but accepts`clazz`parameter as the type required for each item. Compatibility behavior:

- SDK 34 and later, this method matches platform behavior.
- SDK 33 and below, this method will not check the array elements' types.

|                                                       Throws                                                        |
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.os.BadParcelableException](https://developer.android.com/reference/android/os/BadParcelableException.html) | Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children classes or there was an error trying to instantiate an element. |

### writeBoolean

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun writeBoolean(out: Parcel, value: Boolean): Unit
```

Write a boolean value into the parcel at the current f[dataPosition](https://developer.android.com/reference/android/os/Parcel.html#dataPosition()), growing[dataCapacity](https://developer.android.com/reference/android/os/Parcel.html#dataCapacity())if needed.