Methods Summary |
---|
public void | clear()Removes all elements from the mapping of this Bundle.
super.clear();
mHasFds = false;
mFdsKnown = true;
|
public java.lang.Object | clone()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 int | describeContents()Report the nature of this Parcelable's contents
int mask = 0;
if (hasFileDescriptors()) {
mask |= Parcelable.CONTENTS_FILE_DESCRIPTOR;
}
return mask;
|
public static android.os.Bundle | forPair(java.lang.String key, java.lang.String value)Make a Bundle for a single key/value pair.
Bundle b = new Bundle(1);
b.putString(key, value);
return b;
|
public IBinder | getBinder(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.
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 android.os.Bundle | getBundle(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.
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 byte | getByte(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.
return super.getByte(key);
|
public java.lang.Byte | getByte(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.
return super.getByte(key, 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.
return super.getByteArray(key);
|
public char | getChar(java.lang.String key)Returns the value associated with the given key, or (char) 0 if
no mapping of the desired type exists for the given key.
return super.getChar(key);
|
public char | getChar(java.lang.String key, char defaultValue)Returns the value associated with the given key, or defaultValue if
no mapping of the desired type exists for the given key.
return super.getChar(key, 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.
return super.getCharArray(key);
|
public java.lang.CharSequence | getCharSequence(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.
return super.getCharSequence(key);
|
public java.lang.CharSequence | getCharSequence(java.lang.String key, java.lang.CharSequence defaultValue)Returns the value associated with the given key, or defaultValue if
no mapping of the desired type exists for the given key or if a null
value is explicitly associatd with the given key.
return super.getCharSequence(key, defaultValue);
|
public java.lang.CharSequence[] | getCharSequenceArray(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.
return super.getCharSequenceArray(key);
|
public java.util.ArrayList | getCharSequenceArrayList(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.
return super.getCharSequenceArrayList(key);
|
public java.lang.ClassLoader | getClassLoader()Return the ClassLoader currently associated with this Bundle.
return super.getClassLoader();
|
public float | getFloat(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.
return super.getFloat(key);
|
public float | getFloat(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.
return super.getFloat(key, 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.
return super.getFloatArray(key);
|
public IBinder | getIBinder(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.
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 java.util.ArrayList | getIntegerArrayList(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.
return super.getIntegerArrayList(key);
|
public T | getParcelable(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.
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.
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.ArrayList | getParcelableArrayList(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.
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.Serializable | getSerializable(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.
return super.getSerializable(key);
|
public short | getShort(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.
return super.getShort(key);
|
public short | getShort(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.
return super.getShort(key, 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.
return super.getShortArray(key);
|
public android.util.Size | getSize(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.
unparcel();
final Object o = mMap.get(key);
try {
return (Size) o;
} catch (ClassCastException e) {
typeWarning(key, o, "Size", e);
return null;
}
|
public android.util.SizeF | getSizeF(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.
unparcel();
final Object o = mMap.get(key);
try {
return (SizeF) o;
} catch (ClassCastException e) {
typeWarning(key, o, "SizeF", e);
return null;
}
|
public android.util.SparseArray | getSparseParcelableArray(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.
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.util.ArrayList | getStringArrayList(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.
return super.getStringArrayList(key);
|
public boolean | hasFileDescriptors()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
for (int i=mMap.size()-1; i>=0; i--) {
Object obj = mMap.valueAt(i);
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.valueAt(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.isEmpty() && (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 void | putAll(android.os.Bundle bundle)Inserts all mappings from the given Bundle into this Bundle.
unparcel();
bundle.unparcel();
mMap.putAll(bundle.mMap);
// fd state is now known if and only if both bundles already knew
mHasFds |= bundle.mHasFds;
mFdsKnown = mFdsKnown && bundle.mFdsKnown;
|
public void | putBinder(java.lang.String key, IBinder value)Inserts an {@link IBinder} value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
You should be very careful when using this function. In many
places where Bundles are used (such as inside of Intent objects), the Bundle
can live longer inside of another process than the process that had originally
created it. In that case, the IBinder you supply here will become invalid
when your process goes away, and no longer usable, even if a new process is
created for you later on.
unparcel();
mMap.put(key, value);
|
public void | putBundle(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.
unparcel();
mMap.put(key, value);
|
public void | putByte(java.lang.String key, byte value)Inserts a byte value into the mapping of this Bundle, replacing
any existing value for the given key.
super.putByte(key, value);
|
public void | putByteArray(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.
super.putByteArray(key, value);
|
public void | putChar(java.lang.String key, char value)Inserts a char value into the mapping of this Bundle, replacing
any existing value for the given key.
super.putChar(key, value);
|
public void | putCharArray(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.
super.putCharArray(key, value);
|
public void | putCharSequence(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.
super.putCharSequence(key, value);
|
public void | putCharSequenceArray(java.lang.String key, java.lang.CharSequence[] value)Inserts a CharSequence array value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
super.putCharSequenceArray(key, value);
|
public void | putCharSequenceArrayList(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.
super.putCharSequenceArrayList(key, value);
|
public void | putFloat(java.lang.String key, float value)Inserts a float value into the mapping of this Bundle, replacing
any existing value for the given key.
super.putFloat(key, value);
|
public void | putFloatArray(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.
super.putFloatArray(key, value);
|
public void | putIBinder(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.
unparcel();
mMap.put(key, value);
|
public void | putIntegerArrayList(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.
super.putIntegerArrayList(key, value);
|
public void | putParcelable(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.
unparcel();
mMap.put(key, value);
mFdsKnown = false;
|
public void | putParcelableArray(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.
unparcel();
mMap.put(key, value);
mFdsKnown = false;
|
public void | putParcelableArrayList(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.
unparcel();
mMap.put(key, value);
mFdsKnown = false;
|
public void | putParcelableList(java.lang.String key, java.util.List value){@hide}
unparcel();
mMap.put(key, value);
mFdsKnown = false;
|
public void | putSerializable(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.
super.putSerializable(key, value);
|
public void | putShort(java.lang.String key, short value)Inserts a short value into the mapping of this Bundle, replacing
any existing value for the given key.
super.putShort(key, value);
|
public void | putShortArray(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.
super.putShortArray(key, value);
|
public void | putSize(java.lang.String key, android.util.Size value)Inserts a Size value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
unparcel();
mMap.put(key, value);
|
public void | putSizeF(java.lang.String key, android.util.SizeF value)Inserts a SizeF value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
unparcel();
mMap.put(key, value);
|
public void | putSparseParcelableArray(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.
unparcel();
mMap.put(key, value);
mFdsKnown = false;
|
public void | putStringArrayList(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.
super.putStringArrayList(key, value);
|
public void | readFromParcel(Parcel parcel)Reads the Parcel contents into this Bundle, typically in order for
it to be passed through an IBinder connection.
super.readFromParcelInner(parcel);
mHasFds = mParcelledData.hasFileDescriptors();
mFdsKnown = true;
|
public boolean | setAllowFds(boolean allowFds)
boolean orig = mAllowFds;
mAllowFds = allowFds;
return orig;
|
public void | setClassLoader(java.lang.ClassLoader loader)Changes the ClassLoader this Bundle uses when instantiating objects.
super.setClassLoader(loader);
|
public synchronized java.lang.String | toString()
if (mParcelledData != null) {
if (mParcelledData == EMPTY_PARCEL) {
return "Bundle[EMPTY_PARCEL]";
} else {
return "Bundle[mParcelledData.dataSize=" +
mParcelledData.dataSize() + "]";
}
}
return "Bundle[" + mMap.toString() + "]";
|
public void | writeToParcel(Parcel parcel, int flags)Writes the Bundle contents to a Parcel, typically in order for
it to be passed through an IBinder connection.
final boolean oldAllowFds = parcel.pushAllowFds(mAllowFds);
try {
super.writeToParcelInner(parcel, flags);
} finally {
parcel.restoreAllowFds(oldAllowFds);
}
|