public class BundleHelper extends Object
Bundle
objects.Modifier and Type | Method and Description |
---|---|
static <T extends android.os.Parcelable> |
getParcelableArray(android.os.Bundle bundle,
String key,
Class<T[]> type)
This method extracts a
Parcelable array from the Bundle ,
and returns it in an array whose type is the exact Parcelable
subclass. |
public static <T extends android.os.Parcelable> T[] getParcelableArray(android.os.Bundle bundle, String key, Class<T[]> type)
Parcelable
array from the Bundle
,
and returns it in an array whose type is the exact Parcelable
subclass. This is needed because Bundle.getParcelable(String)
returns an array of Parcelable
, and we would get
ClassCastException
when we assign it to Parcelable
subclass arrays.
For more info, see this
url.T
- the element type of the returned arraybundle
- the bundle holding the array which is extractedkey
- the array is associated with this keytype
- the desired type of the returned arrayParcelable
subclass typed array which holds the objects
from Bundle.getParcelableArray(String)
or
null
if Bundle.getParcelableArray(String)
returned null
for the keyCopyright © 2010-2015. All Rights Reserved.