to top
Android APIs
public final class

Bundle

extends Object
implements Parcelable Cloneable
java.lang.Object
   ↳ android.os.Bundle

Class Overview

A mapping from String values to various Parcelable types.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator< Bundle> CREATOR
public static final Bundle EMPTY
Public Constructors

? Examples
Bundle()
Constructs a new, empty Bundle.

? Examples
Bundle( ClassLoader loader)
Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects.

? Examples
Bundle(int capacity)
Constructs a new, empty Bundle sized to hold the given number of elements.

? Examples
Bundle( Bundle b)
Constructs a Bundle containing a copy of the mappings from the given Bundle.
Public Methods

? Examples
void clear()
Removes all elements from the mapping of this Bundle.

? Examples
Object clone()
Clones the current Bundle.

? Examples
boolean containsKey( String key)
Returns true if the given key is contained in the mapping of this Bundle.

? Examples
int describeContents()
Report the nature of this Parcelable's contents

? Examples
Object get( String key)
Returns the entry with the given key as an object.

? Examples
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.

? Examples
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.

? Examples
boolean[] getBooleanArray( 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.

? Examples
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.

? Examples
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.

? Examples
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.

? Examples
byte[] getByteArray( 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.

? Examples
char getChar( 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.

? Examples
char getChar( 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.

? Examples
char[] getCharArray( 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.

? Examples
CharSequence getCharSequence( String key, CharSequence defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

? Examples
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.

? Examples
CharSequence[] getCharSequenceArray( 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.

? Examples
ArrayList< CharSequence> getCharSequenceArrayList( 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.

? Examples
ClassLoader getClassLoader()
Return the ClassLoader currently associated with this Bundle.

? Examples
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.

? Examples
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.

? Examples
double[] getDoubleArray( 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.

? Examples
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.

? Examples
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.

? Examples
float[] getFloatArray( 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.

? Examples
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.

? Examples
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.

? Examples
int[] getIntArray( 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.

? Examples
ArrayList< Integer> getIntegerArrayList( 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.

? Examples
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.

? Examples
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.

? Examples
long[] getLongArray( 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.

? Examples
<T extends  Parcelable> T 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.

? Examples
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.

? Examples
<T extends  Parcelable> ArrayList<T> getParcelableArrayList( 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.

? Examples
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.

? Examples
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.

? Examples
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.

? Examples
short[] getShortArray( 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.

? Examples
<T extends  Parcelable> SparseArray<T> 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.

? Examples
String getString( String key, String defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

? Examples
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.

? Examples
String[] getStringArray( 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.

? Examples
ArrayList< String> getStringArrayList( 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.

? Examples
boolean hasFileDescriptors()
Reports whether the bundle contains any parcelled file descriptors.

? Examples
boolean isEmpty()
Returns true if the mapping of this Bundle is empty, false otherwise.

? Examples
Set< String> keySet()
Returns a Set containing the Strings used as keys in this Bundle.

? Examples
void putAll( Bundle map)
Inserts all mappings from the given Bundle into this Bundle.

? Examples
void putBoolean( String key, boolean value)
Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putBooleanArray( String key, boolean[] value)
Inserts a boolean array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putBundle( String key, Bundle value)
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putByte( String key, byte value)
Inserts a byte value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putByteArray( String key, byte[] value)
Inserts a byte array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putChar( String key, char value)
Inserts a char value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putCharArray( String key, char[] value)
Inserts a char array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putCharSequence( String key, CharSequence value)
Inserts a CharSequence value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putCharSequenceArray( String key, CharSequence[] value)
Inserts a CharSequence array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putCharSequenceArrayList( String key, ArrayList< CharSequence> value)
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putDouble( String key, double value)
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putDoubleArray( String key, double[] value)
Inserts a double array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putFloat( String key, float value)
Inserts a float value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putFloatArray( String key, float[] value)
Inserts a float array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putInt( String key, int value)
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putIntArray( String key, int[] value)
Inserts an int array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putIntegerArrayList( String key, ArrayList< Integer> value)
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putLong( String key, long value)
Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putLongArray( String key, long[] value)
Inserts a long array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putParcelable( String key, Parcelable value)
Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
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.

? Examples
void putParcelableArrayList( String key, ArrayList<? extends  Parcelable> value)
Inserts a List of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putSerializable( String key, Serializable value)
Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putShort( String key, short value)
Inserts a short value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putShortArray( String key, short[] value)
Inserts a short array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putSparseParcelableArray( String key, SparseArray<? extends  Parcelable> value)
Inserts a SparceArray of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putString( String key, String value)
Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putStringArray( String key, String[] value)
Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void putStringArrayList( String key, ArrayList< String> value)
Inserts an ArrayList value into the mapping of this Bundle, replacing any existing value for the given key.

? Examples
void readFromParcel( Parcel parcel)
Reads the Parcel contents into this Bundle, typically in order for it to be passed through an IBinder connection.

? Examples
void remove( String key)
Removes any entry with the given key from the mapping of this Bundle.

? Examples
void setClassLoader( ClassLoader loader)
Changes the ClassLoader this Bundle uses when instantiating objects.

? Examples
int size()
Returns the number of mappings contained in this Bundle.

? Examples
synchronized String toString()
Returns a string containing a concise, human-readable description of this object.

? Examples
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<Bundle> CREATOR

Added in API level 1

public static final Bundle EMPTY

Added in API level 1

Public Constructors

public Bundle ()

Added in API level 1

Constructs a new, empty Bundle.

public Bundle (ClassLoader loader)

Added in API level 1

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.

public Bundle (int capacity)

Added in API level 1

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

public Bundle (Bundle b)

Added in API level 1

Constructs a Bundle containing a copy of the mappings from the given Bundle.

Parameters
b a Bundle to be copied.

Public Methods

public void clear ()

Added in API level 1

Removes all elements from the mapping of this Bundle.

public Object clone ()

Added in API level 1

Clones the current Bundle. The internal map is cloned, but the keys and values to which it refers are copied by reference.

Returns
  • a copy of this object.

public boolean containsKey (String key)

Added in API level 1

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

public int describeContents ()

Added in API level 1

Report the nature of this Parcelable's contents

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public Object get (String key)

Added in API level 1

Returns the entry with the given key as an object.

Parameters
key a String key
Returns
  • an Object, or null

public boolean getBoolean (String key)

Added in API level 1

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

public boolean getBoolean (String key, boolean defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a boolean value

public boolean[] getBooleanArray (String key)

Added in API level 1

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 boolean[] value, or null

public Bundle getBundle (String key)

Added in API level 1

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

public byte getByte (String key)

Added in API level 1

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

public Byte getByte (String key, byte defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a byte value

public byte[] getByteArray (String key)

Added in API level 1

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 byte[] value, or null

public char getChar (String key)

Added in API level 1

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

public char getChar (String key, char defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a char value

public char[] getCharArray (String key)

Added in API level 1

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 char[] value, or null

public CharSequence getCharSequence (String key, CharSequence defaultValue)

Added in API level 12

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, or null
defaultValue Value to return if key does not exist
Returns
  • a CharSequence value, or null

public CharSequence getCharSequence (String key)

Added in API level 1

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

public CharSequence[] getCharSequenceArray (String key)

Added in API level 8

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

public ArrayList<CharSequence> getCharSequenceArrayList (String key)

Added in API level 8

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 ArrayList value, or null

public ClassLoader getClassLoader ()

Added in API level 11

Return the ClassLoader currently associated with this Bundle.

public double getDouble (String key)

Added in API level 1

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

public double getDouble (String key, double defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a double value

public double[] getDoubleArray (String key)

Added in API level 1

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 double[] value, or null

public float getFloat (String key)

Added in API level 1

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

public float getFloat (String key, float defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a float value

public float[] getFloatArray (String key)

Added in API level 1

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 float[] value, or null

public int getInt (String key, int defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • an int value

public int getInt (String key)

Added in API level 1

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

public int[] getIntArray (String key)

Added in API level 1

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 int[] value, or null

public ArrayList<Integer> getIntegerArrayList (String key)

Added in API level 1

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 ArrayList value, or null

public long getLong (String key)

Added in API level 1

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

public long getLong (String key, long defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a long value

public long[] getLongArray (String key)

Added in API level 1

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 long[] value, or null

public T getParcelable (String key)

Added in API level 1

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

public Parcelable[] getParcelableArray (String key)

Added in API level 1

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

public ArrayList<T> getParcelableArrayList (String key)

Added in API level 1

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 ArrayList value, or null

public Serializable getSerializable (String key)

Added in API level 1

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

public short getShort (String key)

Added in API level 1

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

public short getShort (String key, short defaultValue)

Added in API level 1

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
defaultValue Value to return if key does not exist
Returns
  • a short value

public short[] getShortArray (String key)

Added in API level 1

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 short[] value, or null

public SparseArray<T> getSparseParcelableArray (String key)

Added in API level 1

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 T values, or null

public String getString (String key, String defaultValue)

Added in API level 12

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, or null
defaultValue Value to return if key does not exist
Returns
  • a String value, or null

public String getString (String key)

Added in API level 1

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

public String[] getStringArray (String key)

Added in API level 1

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

public ArrayList<String> getStringArrayList (String key)

Added in API level 1

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 ArrayList value, or null

public boolean hasFileDescriptors ()

Added in API level 1

Reports whether the bundle contains any parcelled file descriptors.

public boolean isEmpty ()

Added in API level 1

Returns true if the mapping of this Bundle is empty, false otherwise.

public Set<String> keySet ()

Added in API level 1

Returns a Set containing the Strings used as keys in this Bundle.

Returns
  • a Set of String keys

public void putAll (Bundle map)

Added in API level 1

Inserts all mappings from the given Bundle into this Bundle.

Parameters
map a Bundle

public void putBoolean (String key, boolean value)

Added in API level 1

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

public void putBooleanArray (String key, boolean[] value)

Added in API level 1

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.

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

public void putBundle (String key, Bundle value)

Added in API level 1

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

public void putByte (String key, byte value)

Added in API level 1

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

public void putByteArray (String key, byte[] value)

Added in API level 1

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.

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

public void putChar (String key, char value)

Added in API level 1

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

public void putCharArray (String key, char[] value)

Added in API level 1

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.

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

public void putCharSequence (String key, CharSequence value)

Added in API level 1

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

public void putCharSequenceArray (String key, CharSequence[] value)

Added in API level 8

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.

Parameters
key a String, or null
value a CharSequence array object, or null

public void putCharSequenceArrayList (String key, ArrayList<CharSequence> value)

Added in API level 8

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.

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

public void putDouble (String key, double value)

Added in API level 1

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

public void putDoubleArray (String key, double[] value)

Added in API level 1

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.

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

public void putFloat (String key, float value)

Added in API level 1

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

public void putFloatArray (String key, float[] value)

Added in API level 1

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.

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

public void putInt (String key, int value)

Added in API level 1

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

public void putIntArray (String key, int[] value)

Added in API level 1

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.

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

public void putIntegerArrayList (String key, ArrayList<Integer> value)

Added in API level 1

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.

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

public void putLong (String key, long value)

Added in API level 1

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

public void putLongArray (String key, long[] value)

Added in API level 1

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.

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

public void putParcelable (String key, Parcelable value)

Added in API level 1

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

public void putParcelableArray (String key, Parcelable[] value)

Added in API level 1

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

public void putParcelableArrayList (String key, ArrayList<? extends Parcelable> value)

Added in API level 1

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.

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

public void putSerializable (String key, Serializable value)

Added in API level 1

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

public void putShort (String key, short value)

Added in API level 1

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

public void putShortArray (String key, short[] value)

Added in API level 1

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.

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

public void putSparseParcelableArray (String key, SparseArray<? extends Parcelable> value)

Added in API level 1

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

public void putString (String key, String value)

Added in API level 1

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

public void putStringArray (String key, String[] value)

Added in API level 1

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.

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

public void putStringArrayList (String key, ArrayList<String> value)

Added in API level 1

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.

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

public void readFromParcel (Parcel parcel)

Added in API level 1

Reads the Parcel contents into this Bundle, typically in order for it to be passed through an IBinder connection.

Parameters
parcel The parcel to overwrite this bundle from.

public void remove (String key)

Added in API level 1

Removes any entry with the given key from the mapping of this Bundle.

Parameters
key a String key

public void setClassLoader (ClassLoader loader)

Added in API level 1

Changes the ClassLoader this Bundle uses when instantiating objects.

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

public int size ()

Added in API level 1

Returns the number of mappings contained in this Bundle.

Returns
  • the number of mappings as an int.

public synchronized String toString ()

Added in API level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel parcel, int flags)

Added in API level 1

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.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.