readSupportParcelable

fun <T : Parcelable> Parcel.readSupportParcelable(classLoader: ClassLoader?, clazz: Class<T>): T?

Reads a new Parcelable from the parcel. The given class loader will be used to load any enclosed Parcelables. If it is null, the default class loader will be used.

Note: This method will use the latest APIs introduced with [Build.VERSION_CODES#TIRAMISU], and will fall back on the older APIs on previous versions.

Return

The newly created Parcelable, or null if a null object has been written.

Parameters

classLoader

A ClassLoader from which to instantiate the Parcelable object, or null for the default class loader.

clazz

The object type required for each item.