public final class

Bundle

extends Object
java.lang.Object
   ↳ mindroid.os.Bundle

Class Overview

A mapping from String values to various types.

Summary

Public Constructors
Bundle()
Bundle(Bundle other)
Constructs a Bundle containing a copy of the mappings from the given Bundle.
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.
IBinder getBinder(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 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.
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.
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)
Returns the value associated with the given key, or (byte) 0 if no mapping of the desired type exists for the given 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[] 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.
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.
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.
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.
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.
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[] 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.
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.
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[] 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.
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.
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[] 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.
ArrayList 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.
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.
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[] 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.
Object getObject(String key, Object defaultValue)
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
Object getObject(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.
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.
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.
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.
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.
ArrayList 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.
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 bundle)
Inserts all key-value pairs from the given Bundle into this Bundle.
void putBinder(String key, IBinder value)
Inserts an IBinder value into the mapping of this Bundle, replacing any existing value for the given key.
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 putBooleanArray(String key, boolean[] value)
Inserts a boolean array 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 putByteArray(String key, byte[] value)
Inserts a byte array 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 putCharArray(String key, char[] value)
Inserts a char array 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 putDoubleArray(String key, double[] value)
Inserts a double array 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 putFloatArray(String key, float[] value)
Inserts a float array 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 putIntArray(String key, int[] value)
Inserts an int array value into the mapping of this Bundle, replacing any existing value for the given key.
void putIntegerArrayList(String key, ArrayList value)
Inserts an ArrayList 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 putLongArray(String key, long[] value)
Inserts a long array value into the mapping of this Bundle, replacing any existing value for the given key.
void putObject(String key, Object value)
Inserts an object 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 putShortArray(String key, short[] value)
Inserts a short array value 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 putStringArray(String key, String[] value)
Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key.
void putStringArrayList(String key, ArrayList value)
Inserts an ArrayList 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.
int size()
Returns the number of mappings contained in this Bundle.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Bundle ()

public Bundle (Bundle other)

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

Public Methods

public void clear ()

Removes all elements from the mapping of this Bundle.

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.

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

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

public IBinder getBinder (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

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

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

public 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.

Parameters
key a String, or null
Returns
  • a boolean[] value, or null

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

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

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

public 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.

Parameters
key a String, or null
Returns
  • a byte[] value, or null

public 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.

Parameters
key a String
Returns
  • a char value

public 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.

Parameters
key a String
defaultValue Value to return if key does not exist
Returns
  • a char value

public 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.

Parameters
key a String, or null
Returns
  • a char[] value, or null

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

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

public 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.

Parameters
key a String, or null
Returns
  • a double[] value, or null

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

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

public 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.

Parameters
key a String, or null
Returns
  • a float[] value, or null

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

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

public 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.

Parameters
key a String, or null
Returns
  • an int[] value, or null

public ArrayList 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.

Parameters
key a String, or null
Returns
  • an ArrayList value, or null

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

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

public 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.

Parameters
key a String, or null
Returns
  • a long[] value, or null

public Object getObject (String key, Object 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, or null
defaultValue Value to return if key does not exist
Returns
  • an object value, or null

public Object getObject (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 object value, or null

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

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

public 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.

Parameters
key a String, or null
Returns
  • a short[] value, or null

public 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.

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)

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)

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

Parameters
key a String, or null
Returns
  • an ArrayList value, or null

public boolean isEmpty ()

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

public Set keySet ()

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

Returns
  • a Set of String keys

public void putAll (Bundle bundle)

Inserts all key-value pairs from the given Bundle into this Bundle.

Parameters
bundle a Bundle

public void putBinder (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.

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.

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

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

public 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. 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)

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)

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)

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)

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)

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 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

public 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. 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)

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)

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)

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)

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

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

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

public 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. Either key or value may be null.

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

public void putObject (String key, Object value)

Inserts an object 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 object, or null

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

public 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. Either key or value may be null.

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

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

public 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. 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 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.

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

public void remove (String key)

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

Parameters
key a String key

public int size ()

Returns the number of mappings contained in this Bundle.

Returns
  • the number of mappings as an int.