Condividi tramite


Bundle.GetParcelableArray Method

Definition

Overloads

GetParcelableArray(String)

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

GetParcelableArray(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetParcelableArray(String)

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

[Android.Runtime.Register("getParcelableArray", "(Ljava/lang/String;)[Landroid/os/Parcelable;", "")]
public Android.OS.IParcelable[]? GetParcelableArray (string? key);
[<Android.Runtime.Register("getParcelableArray", "(Ljava/lang/String;)[Landroid/os/Parcelable;", "")>]
member this.GetParcelableArray : string -> Android.OS.IParcelable[]

Parameters

key
String

a String, or null

Returns

a Parcelable[] value, or null

Attributes

Remarks

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

<b>Note: </b> if the expected value is not a class provided by the Android platform, you must call #setClassLoader(ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

This member is deprecated. Use the type-safer #getParcelableArray(String, Class) starting from Android Build.VERSION_CODES#TIRAMISU.

Java documentation for android.os.Bundle.getParcelableArray(java.lang.String).

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

GetParcelableArray(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

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

Parameters

key
String

a String, or null

clazz
Class

The type of the items inside the array. This is only verified when unparceling.

Returns

Object[]

a Parcelable[] value, or null

Attributes

Remarks

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key. <li>A null value is explicitly associated with the key. <li>The object is not of type clazz. </ul>

<b>Note: </b> if the expected value is not a class provided by the Android platform, you must call #setClassLoader(ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

<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 #getParcelableArray(String) instead.

Java documentation for android.os.Bundle.getParcelableArray(java.lang.String, 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