Bundle.GetParcelable Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetParcelable(String) |
Returns the value associated with the given key, or |
GetParcelable(String, Class) |
Returns the value associated with the given key or |
GetParcelable(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("getParcelable", "(Ljava/lang/String;)Landroid/os/Parcelable;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.os.Parcelable" })]
public Java.Lang.Object? GetParcelable (string? key);
[<Android.Runtime.Register("getParcelable", "(Ljava/lang/String;)Landroid/os/Parcelable;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends android.os.Parcelable" })>]
member this.GetParcelable : string -> Java.Lang.Object
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 #getParcelable(String, Class)
starting from Android Build.VERSION_CODES#TIRAMISU
.
Java documentation for android.os.Bundle.getParcelable(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
GetParcelable(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("getParcelable", "(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;", "", ApiSince=33)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public Java.Lang.Object? GetParcelable (string? key, Java.Lang.Class clazz);
[<Android.Runtime.Register("getParcelable", "(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;", "", ApiSince=33)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
member this.GetParcelable : string * Java.Lang.Class -> Java.Lang.Object
Parameters
- key
- String
a String, or null
- clazz
- Class
The type of the object expected
Returns
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> 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 #getParcelable(String)
instead.
Java documentation for android.os.Bundle.getParcelable(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.