Compartilhar via


Bundle.GetSparseParcelableArray Method

Definition

Overloads

GetSparseParcelableArray(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.

GetSparseParcelableArray(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.

GetSparseParcelableArray(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("getSparseParcelableArray", "(Ljava/lang/String;)Landroid/util/SparseArray;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.os.Parcelable" })]
public Android.Util.SparseArray? GetSparseParcelableArray (string? key);
[<Android.Runtime.Register("getSparseParcelableArray", "(Ljava/lang/String;)Landroid/util/SparseArray;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.os.Parcelable" })>]
member this.GetSparseParcelableArray : string -> Android.Util.SparseArray

Parameters

key
String

a String, or null

Returns

a SparseArray of T values, 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.

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

Java documentation for android.os.Bundle.getSparseParcelableArray(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

GetSparseParcelableArray(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("getSparseParcelableArray", "(Ljava/lang/String;Ljava/lang/Class;)Landroid/util/SparseArray;", "", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public Android.Util.SparseArray? GetSparseParcelableArray (string? key, Java.Lang.Class clazz);
[<Android.Runtime.Register("getSparseParcelableArray", "(Ljava/lang/String;Ljava/lang/Class;)Landroid/util/SparseArray;", "", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
member this.GetSparseParcelableArray : string * Java.Lang.Class -> Android.Util.SparseArray

Parameters

key
String

a String, or null

clazz
Class

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

Returns

a SparseArray of T values, 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>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 #getSparseParcelableArray(String) instead.

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