Android APIs
public class

BaseBundle

extends Object
java.lang.Object
   ↳ android.os.BaseBundle
Known Direct Subclasses

Class Overview

A mapping from String values to various types.

Summary

Public Methods
void clear()
Removes all elements from the mapping of this 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.
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.
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.
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.
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.
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.
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.
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.
boolean isEmpty()
Returns true if the mapping of this Bundle is empty, false otherwise.
Set<String> keySet()
Returns a Set containing the Strings used as keys in this Bundle.
void putAll(PersistableBundle bundle)
Inserts all mappings from the given PersistableBundle into this BaseBundle.
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 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 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 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 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 Methods

public void clear ()

Removes all elements from the mapping of this Bundle.

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 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 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 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[] 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 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 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[] 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 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 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[] 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 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
  • the String value associated with the given key, or defaultValue if no valid String object is currently mapped to that key.

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 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 (PersistableBundle bundle)

Inserts all mappings from the given PersistableBundle into this BaseBundle.

Parameters
bundle a PersistableBundle

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 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 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 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 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 int size ()

Added in API level 1

Returns the number of mappings contained in this Bundle.

Returns
  • the number of mappings as an int.