Partager via


Parcel.ReadParcelableArray Method

Definition

Overloads

ReadParcelableArray(ClassLoader)

Read and return a new Parcelable array from the parcel.

ReadParcelableArray(ClassLoader, Class)

Same as #readParcelableArray(ClassLoader) but accepts clazz parameter as the type required for each item.

ReadParcelableArray(ClassLoader)

Read and return a new Parcelable array from the parcel.

[Android.Runtime.Register("readParcelableArray", "(Ljava/lang/ClassLoader;)[Landroid/os/Parcelable;", "")]
public Android.OS.IParcelable[]? ReadParcelableArray (Java.Lang.ClassLoader? loader);
[<Android.Runtime.Register("readParcelableArray", "(Ljava/lang/ClassLoader;)[Landroid/os/Parcelable;", "")>]
member this.ReadParcelableArray : Java.Lang.ClassLoader -> Android.OS.IParcelable[]

Parameters

loader
ClassLoader

Returns

the Parcelable array, or null if the array is null

Attributes

Remarks

Read and return a new Parcelable array from the parcel. The given class loader will be used to load any enclosed Parcelables.

This member is deprecated. Use the type-safer version #readParcelableArray(ClassLoader, Class) starting from Android Build.VERSION_CODES#TIRAMISU. Also consider changing the format to use #createTypedArray(Parcelable.Creator) if possible (eg. if the items' class is final) since this is also more performant. Note that changing to the latter also requires changing the writes.

Java documentation for android.os.Parcel.readParcelableArray(java.lang.ClassLoader).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ReadParcelableArray(ClassLoader, Class)

Same as #readParcelableArray(ClassLoader) but accepts clazz parameter as the type required for each item.

[Android.Runtime.Register("readParcelableArray", "(Ljava/lang/ClassLoader;Ljava/lang/Class;)[Ljava/lang/Object;", "", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public Java.Lang.Object[]? ReadParcelableArray (Java.Lang.ClassLoader? loader, Java.Lang.Class clazz);
[<Android.Runtime.Register("readParcelableArray", "(Ljava/lang/ClassLoader;Ljava/lang/Class;)[Ljava/lang/Object;", "", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
member this.ReadParcelableArray : Java.Lang.ClassLoader * Java.Lang.Class -> Java.Lang.Object[]

Parameters

loader
ClassLoader
clazz
Class

Returns

Object[]
Attributes

Remarks

Same as #readParcelableArray(ClassLoader) but accepts clazz parameter as the type required for each item.

<b>Warning: </b> the class that implements Parcelable has to be the immediately enclosing class of the runtime type of its CREATOR field (that is, Class#getEnclosingClass() has to return the parcelable implementing class), otherwise this method might throw an exception. If the Parcelable class does not enclose the CREATOR, use the deprecated #readParcelableArray(ClassLoader) instead.

Java documentation for android.os.Parcel.readParcelableArray(java.lang.ClassLoader, java.lang.Class<T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to