Share via


Parcel.ReadList Method

Definition

Overloads

ReadList(IList, ClassLoader)

Read into an existing List object from the parcel at the current dataPosition(), using the given class loader to load any enclosed Parcelables.

ReadList(IList, ClassLoader, Class)

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

ReadList(IList, ClassLoader)

Read into an existing List object from the parcel at the current dataPosition(), using the given class loader to load any enclosed Parcelables.

[Android.Runtime.Register("readList", "(Ljava/util/List;Ljava/lang/ClassLoader;)V", "")]
public void ReadList (System.Collections.IList outVal, Java.Lang.ClassLoader? loader);
[<Android.Runtime.Register("readList", "(Ljava/util/List;Ljava/lang/ClassLoader;)V", "")>]
member this.ReadList : System.Collections.IList * Java.Lang.ClassLoader -> unit

Parameters

outVal
IList
loader
ClassLoader
Attributes

Remarks

Read into an existing List object from the parcel at the current dataPosition(), using the given class loader to load any enclosed Parcelables. If it is null, the default class loader is used.

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

ReadList(IList, ClassLoader, Class)

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

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

Parameters

outVal
IList
loader
ClassLoader
clazz
Class
Attributes

Remarks

Same as #readList(List, 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 #readList(List, ClassLoader) instead.

Java documentation for android.os.Parcel.readList(java.util.List<? super T>, 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