FileDocCategorySizeDatePackage
Bundle.javaAPI DocAndroid 1.5 API43095Wed May 06 22:41:56 BST 2009android.os

Bundle

public final class Bundle extends Object implements Parcelable, Cloneable
A mapping from String values to various Parcelable types.

Fields Summary
private static final String
LOG_TAG
public static final Bundle
EMPTY
Map
mMap
Parcel
mParcelledData
private boolean
mHasFds
private boolean
mFdsKnown
private ClassLoader
mClassLoader
The ClassLoader used when unparcelling data from mParcelledData.
public static final Parcelable.Creator
CREATOR
Constructors Summary
public Bundle()
Constructs a new, empty Bundle.


              
      
        mMap = new HashMap<String, Object>();
        mClassLoader = getClass().getClassLoader();
    
Bundle(Parcel parcelledData)
Constructs a Bundle whose data is stored as a Parcel. The data will be unparcelled on first contact, using the assigned ClassLoader.

param
parcelledData a Parcel containing a Bundle

        readFromParcel(parcelledData);
    
public Bundle(ClassLoader loader)
Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects.

param
loader An explicit ClassLoader to use when instantiating objects inside of the Bundle.

        mMap = new HashMap<String, Object>();
        mClassLoader = loader;
    
public Bundle(int capacity)
Constructs a new, empty Bundle sized to hold the given number of elements. The Bundle will grow as needed.

param
capacity the initial capacity of the Bundle

        mMap = new HashMap<String, Object>(capacity);
        mClassLoader = getClass().getClassLoader();
    
public Bundle(Bundle b)
Constructs a Bundle containing a copy of the mappings from the given Bundle.

param
b a Bundle to be copied.

        if (b.mParcelledData != null) {
            mParcelledData = Parcel.obtain();
            mParcelledData.appendFrom(b.mParcelledData, 0, b.mParcelledData.dataSize());
            mParcelledData.setDataPosition(0);
        } else {
            mParcelledData = null;
        }

        if (b.mMap != null) {
            mMap = new HashMap<String, Object>(b.mMap);
        } else {
            mMap = null;
        }

        mHasFds = b.mHasFds;
        mFdsKnown = b.mFdsKnown;
        mClassLoader = b.mClassLoader;
    
Methods Summary
public voidclear()
Removes all elements from the mapping of this Bundle.

        unparcel();
        mMap.clear();
        mHasFds = false;
        mFdsKnown = true;
    
public java.lang.Objectclone()
Clones the current Bundle. The internal map is cloned, but the keys and values to which it refers are copied by reference.

        return new Bundle(this);
    
public booleancontainsKey(java.lang.String key)
Returns true if the given key is contained in the mapping of this Bundle.

param
key a String key
return
true if the key is part of the mapping, false otherwise

        unparcel();
        return mMap.containsKey(key);
    
public intdescribeContents()
Report the nature of this Parcelable's contents


                
       
        int mask = 0;
        if (hasFileDescriptors()) {
            mask |= Parcelable.CONTENTS_FILE_DESCRIPTOR;
        }
        return mask;
    
public java.lang.Objectget(java.lang.String key)
Returns the entry with the given key as an object.

param
key a String key
return
an Object, or null

        unparcel();
        return mMap.get(key);
    
public booleangetBoolean(java.lang.String key)
Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

param
key a String
return
a boolean value

        unparcel();
        return getBoolean(key, false);
    
public booleangetBoolean(java.lang.String key, boolean defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a boolean value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Boolean) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Boolean", defaultValue, e);
            return defaultValue;
        }
    
public boolean[]getBooleanArray(java.lang.String key)
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.

param
key a String, or null
return
a boolean[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (boolean[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "byte[]", e);
            return null;
        }
    
public android.os.BundlegetBundle(java.lang.String key)
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.

param
key a String, or null
return
a Bundle value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (Bundle) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Bundle", e);
            return null;
        }
    
public bytegetByte(java.lang.String key)
Returns the value associated with the given key, or (byte) 0 if no mapping of the desired type exists for the given key.

param
key a String
return
a byte value

        unparcel();
        return getByte(key, (byte) 0);
    
public java.lang.BytegetByte(java.lang.String key, byte defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a byte value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Byte) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Byte", defaultValue, e);
            return defaultValue;
        }
    
public byte[]getByteArray(java.lang.String key)
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.

param
key a String, or null
return
a byte[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (byte[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "byte[]", e);
            return null;
        }
    
public chargetChar(java.lang.String key)
Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.

param
key a String
return
a char value

        unparcel();
        return getChar(key, (char) 0);
    
public chargetChar(java.lang.String key, char defaultValue)
Returns the value associated with the given key, or (char) 0 if no mapping of the desired type exists for the given key.

param
key a String
return
a char value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Character) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Character", defaultValue, e);
            return defaultValue;
        }
    
public char[]getCharArray(java.lang.String key)
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.

param
key a String, or null
return
a char[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (char[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "char[]", e);
            return null;
        }
    
public java.lang.CharSequencegetCharSequence(java.lang.String key)
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.

param
key a String, or null
return
a CharSequence value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (CharSequence) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "CharSequence", e);
            return null;
        }
    
public doublegetDouble(java.lang.String key)
Returns the value associated with the given key, or 0.0 if no mapping of the desired type exists for the given key.

param
key a String
return
a double value

        unparcel();
        return getDouble(key, 0.0);
    
public doublegetDouble(java.lang.String key, double defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a double value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Double) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Double", defaultValue, e);
            return defaultValue;
        }
    
public double[]getDoubleArray(java.lang.String key)
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.

param
key a String, or null
return
a double[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (double[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "double[]", e);
            return null;
        }
    
public floatgetFloat(java.lang.String key)
Returns the value associated with the given key, or 0.0f if no mapping of the desired type exists for the given key.

param
key a String
return
a float value

        unparcel();
        return getFloat(key, 0.0f);
    
public floatgetFloat(java.lang.String key, float defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a float value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Float) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Float", defaultValue, e);
            return defaultValue;
        }
    
public float[]getFloatArray(java.lang.String key)
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.

param
key a String, or null
return
a float[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (float[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "float[]", e);
            return null;
        }
    
public IBindergetIBinder(java.lang.String key)
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.

param
key a String, or null
return
an IBinder value, or null
deprecated
hide

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (IBinder) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "IBinder", e);
            return null;
        }
    
public intgetInt(java.lang.String key)
Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

param
key a String
return
an int value

        unparcel();
        return getInt(key, 0);
    
public intgetInt(java.lang.String key, int defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
an int value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Integer) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Integer", defaultValue, e);
            return defaultValue;
        }
    
public int[]getIntArray(java.lang.String key)
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.

param
key a String, or null
return
an int[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (int[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "int[]", e);
            return null;
        }
    
public java.util.ArrayListgetIntegerArrayList(java.lang.String key)
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.

param
key a String, or null
return
an ArrayList value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (ArrayList<Integer>) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "ArrayList<Integer>", e);
            return null;
        }
    
public longgetLong(java.lang.String key)
Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.

param
key a String
return
a long value

        unparcel();
        return getLong(key, 0L);
    
public longgetLong(java.lang.String key, long defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a long value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Long) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Long", defaultValue, e);
            return defaultValue;
        }
    
public long[]getLongArray(java.lang.String key)
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.

param
key a String, or null
return
a long[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (long[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "long[]", e);
            return null;
        }
    
public TgetParcelable(java.lang.String key)
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.

param
key a String, or null
return
a Parcelable value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (T) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Parcelable", e);
            return null;
        }
    
public Parcelable[]getParcelableArray(java.lang.String key)
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.

param
key a String, or null
return
a Parcelable[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (Parcelable[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Parcelable[]", e);
            return null;
        }
    
public java.util.ArrayListgetParcelableArrayList(java.lang.String key)
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.

param
key a String, or null
return
an ArrayList value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (ArrayList<T>) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "ArrayList", e);
            return null;
        }
    
public java.io.SerializablegetSerializable(java.lang.String key)
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.

param
key a String, or null
return
a Serializable value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (Serializable) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Serializable", e);
            return null;
        }
    
public shortgetShort(java.lang.String key)
Returns the value associated with the given key, or (short) 0 if no mapping of the desired type exists for the given key.

param
key a String
return
a short value

        unparcel();
        return getShort(key, (short) 0);
    
public shortgetShort(java.lang.String key, short defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

param
key a String
return
a short value

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return defaultValue;
        }
        try {
            return (Short) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "Short", defaultValue, e);
            return defaultValue;
        }
    
public short[]getShortArray(java.lang.String key)
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.

param
key a String, or null
return
a short[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (short[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "short[]", e);
            return null;
        }
    
public android.util.SparseArraygetSparseParcelableArray(java.lang.String key)
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.

param
key a String, or null
return
a SparseArray of T values, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (SparseArray<T>) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "SparseArray", e);
            return null;
        }
    
public java.lang.StringgetString(java.lang.String key)
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.

param
key a String, or null
return
a String value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (String) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "String", e);
            return null;
        }
    
public java.lang.String[]getStringArray(java.lang.String key)
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.

param
key a String, or null
return
a String[] value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (String[]) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "String[]", e);
            return null;
        }
    
public java.util.ArrayListgetStringArrayList(java.lang.String key)
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.

param
key a String, or null
return
an ArrayList value, or null

        unparcel();
        Object o = mMap.get(key);
        if (o == null) {
            return null;
        }
        try {
            return (ArrayList<String>) o;
        } catch (ClassCastException e) {
            typeWarning(key, o, "ArrayList<String>", e);
            return null;
        }
    
public booleanhasFileDescriptors()
Reports whether the bundle contains any parcelled file descriptors.

        if (!mFdsKnown) {
            boolean fdFound = false;    // keep going until we find one or run out of data
            
            if (mParcelledData != null) {
                if (mParcelledData.hasFileDescriptors()) {
                    fdFound = true;
                }
            } else {
                // It's been unparcelled, so we need to walk the map
                Iterator<Map.Entry<String, Object>> iter = mMap.entrySet().iterator();
                while (!fdFound && iter.hasNext()) {
                    Object obj = iter.next().getValue();
                    if (obj instanceof Parcelable) {
                        if ((((Parcelable)obj).describeContents()
                                & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) {
                            fdFound = true;
                            break;
                        }
                    } else if (obj instanceof Parcelable[]) {
                        Parcelable[] array = (Parcelable[]) obj;
                        for (int n = array.length - 1; n >= 0; n--) {
                            if ((array[n].describeContents()
                                    & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) {
                                fdFound = true;
                                break;
                            }
                        }
                    } else if (obj instanceof SparseArray) {
                        SparseArray<? extends Parcelable> array =
                                (SparseArray<? extends Parcelable>) obj;
                        for (int n = array.size() - 1; n >= 0; n--) {
                            if ((array.get(n).describeContents()
                                    & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) {
                                fdFound = true;
                                break;
                            }
                        }
                    } else if (obj instanceof ArrayList) {
                        ArrayList array = (ArrayList) obj;
                        // an ArrayList here might contain either Strings or
                        // Parcelables; only look inside for Parcelables
                        if ((array.size() > 0)
                                && (array.get(0) instanceof Parcelable)) {
                            for (int n = array.size() - 1; n >= 0; n--) {
                                Parcelable p = (Parcelable) array.get(n);
                                if (p != null && ((p.describeContents()
                                        & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0)) {
                                    fdFound = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            mHasFds = fdFound;
            mFdsKnown = true;
        }
        return mHasFds;
    
public booleanisEmpty()
Returns true if the mapping of this Bundle is empty, false otherwise.

        unparcel();
        return mMap.isEmpty();
    
public java.util.SetkeySet()
Returns a Set containing the Strings used as keys in this Bundle.

return
a Set of String keys

        unparcel();
        return mMap.keySet();
    
public voidputAll(android.os.Bundle map)
Inserts all mappings from the given Bundle into this Bundle.

param
map a Bundle

        unparcel();
        map.unparcel();
        mMap.putAll(map.mMap);

        // fd state is now known if and only if both bundles already knew
        mHasFds |= map.mHasFds;
        mFdsKnown = mFdsKnown && map.mFdsKnown;
    
public voidputBoolean(java.lang.String key, boolean value)
Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a Boolean, or null

        unparcel();
        mMap.put(key, value);
    
public voidputBooleanArray(java.lang.String key, boolean[] value)
Inserts a boolean array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a boolean array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputBundle(java.lang.String key, android.os.Bundle value)
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a Bundle object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputByte(java.lang.String key, byte value)
Inserts a byte value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a byte

        unparcel();
        mMap.put(key, value);
    
public voidputByteArray(java.lang.String key, byte[] value)
Inserts a byte array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a byte array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputChar(java.lang.String key, char value)
Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a char, or null

        unparcel();
        mMap.put(key, value);
    
public voidputCharArray(java.lang.String key, char[] value)
Inserts a char array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a char array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputCharSequence(java.lang.String key, java.lang.CharSequence value)
Inserts a CharSequence value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a CharSequence, or null

        unparcel();
        mMap.put(key, value);
    
public voidputDouble(java.lang.String key, double value)
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a double

        unparcel();
        mMap.put(key, value);
    
public voidputDoubleArray(java.lang.String key, double[] value)
Inserts a double array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a double array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputFloat(java.lang.String key, float value)
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a float

        unparcel();
        mMap.put(key, value);
    
public voidputFloatArray(java.lang.String key, float[] value)
Inserts a float array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a float array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputIBinder(java.lang.String key, IBinder value)
Inserts an IBinder value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an IBinder object, or null
deprecated
hide

        unparcel();
        mMap.put(key, value);
    
public voidputInt(java.lang.String key, int value)
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value an int, or null

        unparcel();
        mMap.put(key, value);
    
public voidputIntArray(java.lang.String key, int[] value)
Inserts an int array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an int array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputIntegerArrayList(java.lang.String key, java.util.ArrayList value)
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an ArrayList object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputLong(java.lang.String key, long value)
Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a long

        unparcel();
        mMap.put(key, value);
    
public voidputLongArray(java.lang.String key, long[] value)
Inserts a long array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a long array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputParcelable(java.lang.String key, Parcelable value)
Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a Parcelable object, or null

        unparcel();
        mMap.put(key, value);
        mFdsKnown = false;
    
public voidputParcelableArray(java.lang.String key, Parcelable[] value)
Inserts an array of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an array of Parcelable objects, or null

        unparcel();
        mMap.put(key, value);
        mFdsKnown = false;
    
public voidputParcelableArrayList(java.lang.String key, java.util.ArrayList value)
Inserts a List of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an ArrayList of Parcelable objects, or null

        unparcel();
        mMap.put(key, value);
        mFdsKnown = false;
    
public voidputSerializable(java.lang.String key, java.io.Serializable value)
Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a Serializable object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputShort(java.lang.String key, short value)
Inserts a short value into the mapping of this Bundle, replacing any existing value for the given key.

param
key a String, or null
param
value a short

        unparcel();
        mMap.put(key, value);
    
public voidputShortArray(java.lang.String key, short[] value)
Inserts a short array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a short array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputSparseParcelableArray(java.lang.String key, android.util.SparseArray value)
Inserts a SparceArray of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a SparseArray of Parcelable objects, or null

        unparcel();
        mMap.put(key, value);
        mFdsKnown = false;
    
public voidputString(java.lang.String key, java.lang.String value)
Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a String, or null

        unparcel();
        mMap.put(key, value);
    
public voidputStringArray(java.lang.String key, java.lang.String[] value)
Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value a String array object, or null

        unparcel();
        mMap.put(key, value);
    
public voidputStringArrayList(java.lang.String key, java.util.ArrayList value)
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null.

param
key a String, or null
param
value an ArrayList object, or null

        unparcel();
        mMap.put(key, value);
    
public voidreadFromParcel(Parcel parcel)
Reads the Parcel contents into this Bundle, typically in order for it to be passed through an IBinder connection.

param
parcel The parcel to overwrite this bundle from.

        mParcelledData = parcel;
        mHasFds = mParcelledData.hasFileDescriptors();
        mFdsKnown = true;
    
public voidremove(java.lang.String key)
Removes any entry with the given key from the mapping of this Bundle.

param
key a String key

        unparcel();
        mMap.remove(key);
    
public voidsetClassLoader(java.lang.ClassLoader loader)
Changes the ClassLoader this Bundle uses when instantiating objects.

param
loader An explicit ClassLoader to use when instantiating objects inside of the Bundle.

        mClassLoader = loader;
    
public intsize()
Returns the number of mappings contained in this Bundle.

return
the number of mappings as an int.

        unparcel();
        return mMap.size();
    
public synchronized java.lang.StringtoString()

        if (mParcelledData != null) {
            return "Bundle[mParcelledData.dataSize=" +
                    mParcelledData.dataSize() + "]";
        }
        return "Bundle[" + mMap.toString() + "]";
    
private voidtypeWarning(java.lang.String key, java.lang.Object value, java.lang.String className, java.lang.Object defaultValue, java.lang.ClassCastException e)

        StringBuilder sb = new StringBuilder();
        sb.append("Key ");
        sb.append(key);
        sb.append(" expected ");
        sb.append(className);
        sb.append(" but value was a ");
        sb.append(value.getClass().getName());
        sb.append(".  The default value ");
        sb.append(defaultValue);
        sb.append(" was returned.");
        Log.w(LOG_TAG, sb.toString());
        Log.w(LOG_TAG, "Attempt to cast generated internal exception:", e);
    
private voidtypeWarning(java.lang.String key, java.lang.Object value, java.lang.String className, java.lang.ClassCastException e)

        typeWarning(key, value, className, "<null>", e);
    
synchronized voidunparcel()
If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.

        if (mParcelledData == null) {
            return;
        }

        mParcelledData.setDataPosition(0);
        Bundle b = mParcelledData.readBundleUnpacked(mClassLoader);
        mMap = b.mMap;

        mHasFds = mParcelledData.hasFileDescriptors();
        mFdsKnown = true;
        
        mParcelledData.recycle();
        mParcelledData = null;
    
public voidwriteToParcel(Parcel parcel, int flags)
Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.

param
parcel The parcel to copy this bundle to.

        parcel.writeBundle(this);