Reference:Android.os.Bundle
From Triled Wiki
android.os
public final class android.os.Bundle
| java.lang.Object | ||
| android.os.Bundle | Parcelable Cloneable | |
A mapping from String values to various Parcelable types.
[edit] Summary
[edit] Constants
| Value | ||||
|---|---|---|---|---|
| Creator | CREATOR | |||
| Bundle | EMPTY |
[edit] Public Constructors
| Bundle () | |||||
| Constructs a new, empty Bundle. | |||||
| Bundle (ClassLoader loader) | |||||
| Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects. | |||||
| Bundle (int capacity) | |||||
| Constructs a new, empty Bundle sized to hold the given number of elements. | |||||
| Bundle (Bundle b) | |||||
| Constructs a Bundle containing a copy of the mappings from the given Bundle. | |||||
[edit] Public Methods
| void | clear () | ||||
| Removes all elements from the mapping of this Bundle. | |||||
| Object | clone () | ||||
| Clones the current Bundle. | |||||
| boolean | containsKey (String key) | ||||
| Returns true if the given key is contained in the mapping of this Bundle. | |||||
| Object | get (String key) | ||||
| Returns the entry with the given key as an object. | |||||
| boolean | getBoolean (String key) | ||||
| Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key. | |||||
| boolean | getBoolean (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. | |||||
| Bundle | getBundle (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. | |||||
| Byte | getByte (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. | |||||
| byte | getByte (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. | |||||
| char | getChar (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. | |||||
| char | getChar (String key) | ||||
| Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key. | |||||
| CharSequence | getCharSequence (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. | |||||
| double | getDouble (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. | |||||
| double | getDouble (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. | |||||
| float | getFloat (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. | |||||
| float | getFloat (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. | |||||
| IBinder | getIBinder (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. | |||||
| int | getInt (String key) | ||||
| Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key. | |||||
| int | getInt (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. | |||||
| long | getLong (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. | |||||
| long | getLong (String key) | ||||
| Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key. | |||||
| Parcelable | getParcelable (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. | |||||
| Parcelable[ ] | getParcelableArray (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. | |||||
| Serializable | getSerializable (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. | |||||
| short | getShort (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. | |||||
| short | getShort (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. | |||||
| SparseArray | getSparseParcelableArray (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. | |||||
| String | getString (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. | |||||
| boolean | isEmpty () | ||||
| Returns true if the mapping of this Bundle is empty, false otherwise. | |||||
| Set | keySet () | ||||
| Returns a Set containing the Strings used as keys in this Bundle. | |||||
| void | putAll (Bundle map) | ||||
| Inserts all mappings from the given Bundle into this Bundle. | |||||
| void | putBoolean (String key, boolean value) | ||||
| Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putBundle (String key, Bundle value) | ||||
| Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putByte (String key, byte value) | ||||
| Inserts a byte value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putChar (String key, char value) | ||||
| Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putCharSequence (String key, CharSequence value) | ||||
| Inserts a CharSequence value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putDouble (String key, double value) | ||||
| Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putFloat (String key, float value) | ||||
| Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putIBinder (String key, IBinder value) | ||||
| Inserts an IBinder value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putInt (String key, int value) | ||||
| Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putLong (String key, long value) | ||||
| Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putParcelable (String key, Parcelable value) | ||||
| Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putParcelableArray (String key, Parcelable[ ] value) | ||||
| Inserts an array of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putSerializable (String key, Serializable value) | ||||
| Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putShort (String key, short value) | ||||
| Inserts a short value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | )">putSparceParcelableArray (String key, SparseArray value) | ||||
| Inserts a SparceArray of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | putString (String key, String value) | ||||
| Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key. | |||||
| void | remove (String key) | ||||
| Removes any entry with the given key from the mapping of this Bundle. | |||||
| void | setClassLoader (ClassLoader loader) | ||||
| Changes the ClassLoader this Bundle uses when instantiating objects. | |||||
| int | size () | ||||
| Returns the number of mappings contained in this Bundle. | |||||
| synchronized | String | toString () | |||
| Answers a string containing a concise, human-readable description of the receiver. | |||||
| void | writeToParcel (Parcel parcel) | ||||
| Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection. | |||||
[edit] Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait[edit] Methods inherited from interface android.os.Parcelable
[edit] Details
[edit] Constants
[edit] public static final Creator CREATOR
[edit] public static final Bundle EMPTY
[edit] Public Constructors
[edit] public Bundle()
Constructs a new, empty Bundle.
[edit] public Bundle(ClassLoader loader)
Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects.
Parameters
| loader | An explicit ClassLoader to use when instantiating objects inside of the Bundle. |
|---|
[edit] public Bundle(int capacity)
Constructs a new, empty Bundle sized to hold the given number of elements. The Bundle will grow as needed.
Parameters
| capacity | the initial capacity of the Bundle |
|---|
[edit] public Bundle(Bundle b)
Constructs a Bundle containing a copy of the mappings from the given Bundle.
Parameters
| b | a Bundle to be copied. |
|---|
[edit] Public Methods
[edit] public void clear()
Removes all elements from the mapping of this Bundle.
[edit] public Object clone()
Clones the current Bundle. The internal map is cloned, but the keys and values to which it refers are copied by reference.
[edit] public boolean containsKey(String key)
Returns true if the given key is contained in the mapping of this Bundle.
Parameters
| key | a String key |
|---|
Returns
- true if the key is part of the mapping, false otherwise
[edit] public Object get(String key)
Returns the entry with the given key as an object.
Parameters
| key | a String key |
|---|
Returns
- an Object, or null
[edit] public boolean getBoolean(String key)
Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.
Parameters
| key | a String |
|---|
Returns
- a boolean value
[edit] public boolean getBoolean(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.
Parameters
| key | a String |
|---|
Returns
- a boolean value
[edit] public Bundle getBundle(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.
Parameters
| key | a String, or null |
|---|
Returns
- a Bundle value, or null
[edit] public Byte getByte(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.
Parameters
| key | a String |
|---|
Returns
- a byte value
[edit] public byte getByte(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.
Parameters
| key | a String |
|---|
Returns
- a byte value
[edit] public char getChar(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.
Parameters
| key | a String |
|---|
Returns
- a char value
[edit] public char getChar(String key)
Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.
Parameters
| key | a String |
|---|
Returns
- a char value
[edit] public CharSequence getCharSequence(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.
Parameters
| key | a String, or null |
|---|
Returns
- a CharSequence value, or null
[edit] public double getDouble(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.
Parameters
| key | a String |
|---|
Returns
- a double value
[edit] public double getDouble(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.
Parameters
| key | a String |
|---|
Returns
- a double value
[edit] public float getFloat(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.
Parameters
| key | a String |
|---|
Returns
- a float value
[edit] public float getFloat(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.
Parameters
| key | a String |
|---|
Returns
- a float value
[edit] public IBinder getIBinder(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.
Parameters
| key | a String, or null |
|---|
Returns
- an IBinder value, or null
[edit] public int getInt(String key)
Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.
Parameters
| key | a String |
|---|
Returns
- an int value
[edit] public int getInt(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.
Parameters
| key | a String |
|---|
Returns
- an int value
[edit] public long getLong(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.
Parameters
| key | a String |
|---|
Returns
- a long value
[edit] public long getLong(String key)
Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.
Parameters
| key | a String |
|---|
Returns
- a long value
[edit] public Parcelable getParcelable(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.
Parameters
| key | a String, or null |
|---|
Returns
- a Parcelable value, or null
[edit] public Parcelable[ ]getParcelableArray(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.
Parameters
| key | a String, or null |
|---|
Returns
- a Parcelable[] value, or null
[edit] public Serializable getSerializable(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.
Parameters
| key | a String, or null |
|---|
Returns
- a Serializable value, or null
[edit] public short getShort(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.
Parameters
| key | a String |
|---|
Returns
- a short value
[edit] public short getShort(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.
Parameters
| key | a String |
|---|
Returns
- a short value
[edit] public SparseArray getSparseParcelableArray(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.
Parameters
| key | a String, or null |
|---|
Returns
- a SparseArray of Parcelable values, or null
[edit] public String getString(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.
Parameters
| key | a String, or null |
|---|
Returns
- a String value, or null
[edit] public boolean isEmpty()
Returns true if the mapping of this Bundle is empty, false otherwise.
[edit] public Set keySet()
Returns a Set containing the Strings used as keys in this Bundle.
Returns
- a Set of String keys
[edit] public void putAll(Bundle map)
Inserts all mappings from the given Bundle into this Bundle.
Parameters
| map | a Bundle |
|---|
[edit] public void putBoolean(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.
Parameters
| key | a String, or null |
|---|---|
| value | a Boolean, or null |
[edit] public void putBundle(String key, 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.
Parameters
| key | a String, or null |
|---|---|
| value | a Bundle object, or null |
[edit] public void putByte(String key, byte value)
Inserts a byte value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a byte |
[edit] public void putChar(String key, char value)
Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a char, or null |
[edit] public void putCharSequence(String key, 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.
Parameters
| key | a String, or null |
|---|---|
| value | a CharSequence, or null |
[edit] public void putDouble(String key, double value)
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a double |
[edit] public void putFloat(String key, float value)
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a float |
[edit] public void putIBinder(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.
Parameters
| key | a String, or null |
|---|---|
| value | an IBinder object, or null |
[edit] public void putInt(String key, int value)
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | an int, or null |
[edit] public void putLong(String key, long value)
Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a long |
[edit] public void putParcelable(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.
Parameters
| key | a String, or null |
|---|---|
| value | a Parcelable object, or null |
[edit] public void putParcelableArray(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.
Parameters
| key | a String, or null |
|---|---|
| value | an array of Parcelable objects, or null |
[edit] public void putSerializable(String key, 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.
Parameters
| key | a String, or null |
|---|---|
| value | a Serializable object, or null |
[edit] public void putShort(String key, short value)
Inserts a short value into the mapping of this Bundle, replacing any existing value for the given key.
Parameters
| key | a String, or null |
|---|---|
| value | a short |
[edit] public void putSparceParcelableArray(String key, 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.
Parameters
| key | a String, or null |
|---|---|
| value | a SparseArray of Parcelable objects, or null |
[edit] public void putString(String key, 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.
Parameters
| key | a String, or null |
|---|---|
| value | a String, or null |
[edit] public void remove(String key)
Removes any entry with the given key from the mapping of this Bundle.
Parameters
| key | a String key |
|---|
[edit] public void setClassLoader(ClassLoader loader)
Changes the ClassLoader this Bundle uses when instantiating objects.
Parameters
| loader | An explicit ClassLoader to use when instantiating objects inside of the Bundle. |
|---|
[edit] public int size()
Returns the number of mappings contained in this Bundle.
Returns
- the number of mappings as an int.
[edit] public synchronized String toString()
Answers a string containing a concise, human-readable description of the receiver.
[edit] public void writeToParcel(Parcel parcel)
Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
Parameters
| parcel | The parcel to copy this bundle to. |
|---|
[edit] References
- Original documentation page for Android SDK build m5-rc15e - 14 apr 2008 17:27
