Udostępnij za pośrednictwem


Parcel.ReadArrayList Method

Definition

Overloads

ReadArrayList(ClassLoader)

Read and return a new ArrayList object from the parcel at the current dataPosition().

ReadArrayList(ClassLoader, Class)

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

ReadArrayList(ClassLoader)

Read and return a new ArrayList object from the parcel at the current dataPosition().

[Android.Runtime.Register("readArrayList", "(Ljava/lang/ClassLoader;)Ljava/util/ArrayList;", "")]
public System.Collections.IList? ReadArrayList (Java.Lang.ClassLoader? loader);
[<Android.Runtime.Register("readArrayList", "(Ljava/lang/ClassLoader;)Ljava/util/ArrayList;", "")>]
member this.ReadArrayList : Java.Lang.ClassLoader -> System.Collections.IList

Parameters

loader
ClassLoader

Returns

Attributes

Remarks

Read and return a new ArrayList object from the parcel at the current dataPosition(). Returns null if the previously written list object was null. The given class loader will be used to load any enclosed Parcelables.

This member is deprecated. Use the type-safer version #readArrayList(ClassLoader, Class) starting from Android Build.VERSION_CODES#TIRAMISU. Also consider changing the format to use #createTypedArrayList(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.readArrayList(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

ReadArrayList(ClassLoader, Class)

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

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

Parameters

loader
ClassLoader
clazz
Class

Returns

Attributes

Remarks

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

<b>Warning: </b> if the list contains items implementing the Parcelable interface, 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 #readArrayList(ClassLoader) instead.

Java documentation for android.os.Parcel.readArrayList(java.lang.ClassLoader, java.lang.Class<? extends 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