BaseBundle
open class BaseBundle
| kotlin.Any | |
| ↳ | android.os.BaseBundle |
A mapping from String keys to values of various types. In most cases, you should work directly with either the Bundle or PersistableBundle subclass.
Summary
| Public methods | |
|---|---|
| open Unit |
clear()Removes all elements from the mapping of this Bundle. |
| open Boolean |
containsKey(key: String!)Returns true if the given key is contained in the mapping of this Bundle. |
| open Any? |
Returns the entry with the given key as an object. |
| open Boolean |
getBoolean(key: String!)Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key. |
| open Boolean |
getBoolean(key: String!, defaultValue: Boolean)Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key. |
| open BooleanArray? |
getBooleanArray(key: String?)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. |
| open Double |
Returns the value associated with the given key, or 0. |
| open Double |
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key. |
| open DoubleArray? |
getDoubleArray(key: String?)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. |
| open Int |
Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key. |
| open Int |
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key. |
| open IntArray? |
getIntArray(key: String?)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. |
| open Long |
Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key. |
| open Long |
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key. |
| open LongArray? |
getLongArray(key: String?)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. |
| open String? |
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. |
| open String! |
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key or if a null value is explicitly associated with the given key. |
| open Array<String!>? |
getStringArray(key: String?)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. |
| open Boolean |
isEmpty()Returns true if the mapping of this Bundle is empty, false otherwise. |
| open MutableSet<String!>! |
keySet()Returns a Set containing the Strings used as keys in this Bundle. |
| open Unit |
putAll(bundle: PersistableBundle!)Inserts all mappings from the given PersistableBundle into this BaseBundle. |
| open Unit |
putBoolean(key: String?, value: Boolean)Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
putBooleanArray(key: String?, value: BooleanArray?)Inserts a boolean array value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
putDoubleArray(key: String?, value: DoubleArray?)Inserts a double array value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
putIntArray(key: String?, value: IntArray?)Inserts an int array value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
putLongArray(key: String?, value: LongArray?)Inserts a long array value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
putStringArray(key: String?, value: Array<String!>?)Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key. |
| open Unit |
Removes any entry with the given key from the mapping of this Bundle. |
| open Int |
size()Returns the number of mappings contained in this Bundle. |
Public methods
clear
open fun clear(): Unit
Removes all elements from the mapping of this Bundle. Recycles the underlying parcel if it is still present.
containsKey
open fun containsKey(key: String!): Boolean
Returns true if the given key is contained in the mapping of this Bundle.
| Parameters | |
|---|---|
key |
String!: a String key |
| Return | |
|---|---|
Boolean |
true if the key is part of the mapping, false otherwise |
get
open funget(key: String!): Any?
Deprecated: Use the type-safe specific APIs depending on the type of the item to be retrieved, eg. getString(java.lang.String).
Returns the entry with the given key as an object.
| Parameters | |
|---|---|
key |
String!: a String key |
| Return | |
|---|---|
Any? |
an Object, or null |
getBoolean
open fun getBoolean(key: String!): Boolean
Returns the value associated with the given key, or false if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
| Return | |
|---|---|
Boolean |
a boolean value |
getBoolean
open fun getBoolean(
key: String!,
defaultValue: Boolean
): Boolean
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
defaultValue |
Boolean: Value to return if key does not exist |
| Return | |
|---|---|
Boolean |
a boolean value |
getBooleanArray
open fun getBooleanArray(key: String?): BooleanArray?
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 |
String?: a String, or null |
| Return | |
|---|---|
BooleanArray? |
a boolean[] value, or null |
getDouble
open fun getDouble(key: String!): Double
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 |
String!: a String |
| Return | |
|---|---|
Double |
a double value |
getDouble
open fun getDouble(
key: String!,
defaultValue: Double
): Double
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
defaultValue |
Double: Value to return if key does not exist |
| Return | |
|---|---|
Double |
a double value |
getDoubleArray
open fun getDoubleArray(key: String?): DoubleArray?
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 |
String?: a String, or null |
| Return | |
|---|---|
DoubleArray? |
a double[] value, or null |
getInt
open fun getInt(key: String!): Int
Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
| Return | |
|---|---|
Int |
an int value |
getInt
open fun getInt(
key: String!,
defaultValue: Int
): Int
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
defaultValue |
Int: Value to return if key does not exist |
| Return | |
|---|---|
Int |
an int value |
getIntArray
open fun getIntArray(key: String?): IntArray?
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 |
String?: a String, or null |
| Return | |
|---|---|
IntArray? |
an int[] value, or null |
getLong
open fun getLong(key: String!): Long
Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
| Return | |
|---|---|
Long |
a long value |
getLong
open fun getLong(
key: String!,
defaultValue: Long
): Long
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
| Parameters | |
|---|---|
key |
String!: a String |
defaultValue |
Long: Value to return if key does not exist |
| Return | |
|---|---|
Long |
a long value |
getLongArray
open fun getLongArray(key: String?): LongArray?
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 |
String?: a String, or null |
| Return | |
|---|---|
LongArray? |
a long[] value, or null |
getString
open fun getString(key: String?): String?
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 |
String?: a String, or null |
| Return | |
|---|---|
String? |
a String value, or null |
getString
open fun getString(
key: String?,
defaultValue: String!
): String!
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key or if a null value is explicitly associated with the given key.
| Parameters | |
|---|---|
key |
String?: a String, or null |
defaultValue |
String!: Value to return if key does not exist or if a null value is associated with the given key. |
| Return | |
|---|---|
String! |
the String value associated with the given key, or defaultValue if no valid String object is currently mapped to that key. |
getStringArray
open fun getStringArray(key: String?): Array<String!>?
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 |
String?: a String, or null |
| Return | |
|---|---|
Array<String!>? |
a String[] value, or null |
isEmpty
open fun isEmpty(): Boolean
Returns true if the mapping of this Bundle is empty, false otherwise.
keySet
open fun keySet(): MutableSet<String!>!
Returns a Set containing the Strings used as keys in this Bundle.
| Return | |
|---|---|
MutableSet<String!>! |
a Set of String keys |
putAll
open fun putAll(bundle: PersistableBundle!): Unit
Inserts all mappings from the given PersistableBundle into this BaseBundle.
| Parameters | |
|---|---|
bundle |
PersistableBundle!: a PersistableBundle |
putBoolean
open fun putBoolean(
key: String?,
value: Boolean
): Unit
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 |
String?: a String, or null |
value |
Boolean: a boolean |
putBooleanArray
open fun putBooleanArray(
key: String?,
value: BooleanArray?
): Unit
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 |
String?: a String, or null |
value |
BooleanArray?: a boolean array object, or null |
putDouble
open fun putDouble(
key: String?,
value: Double
): Unit
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.
| Parameters | |
|---|---|
key |
String?: a String, or null |
value |
Double: a double |
putDoubleArray
open fun putDoubleArray(
key: String?,
value: DoubleArray?
): Unit
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 |
String?: a String, or null |
value |
DoubleArray?: a double array object, or null |
putInt
open fun putInt(
key: String?,
value: Int
): Unit
Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.
| Parameters | |
|---|---|
key |
String?: a String, or null |
value |
Int: an int |
putIntArray
open fun putIntArray(
key: String?,
value: IntArray?
): Unit
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 |
String?: a String, or null |
value |
IntArray?: an int array object, or null |
putLong
open fun putLong(
key: String?,
value: Long
): Unit
Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key.
| Parameters | |
|---|---|
key |
String?: a String, or null |
value |
Long: a long |
putLongArray
open fun putLongArray(
key: String?,
value: LongArray?
): Unit
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 |
String?: a String, or null |
value |
LongArray?: a long array object, or null |
putString
open fun putString(
key: String?,
value: String?
): Unit
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 |
String?: a String, or null |
value |
String?: a String, or null |
putStringArray
open fun putStringArray(
key: String?,
value: Array<String!>?
): Unit
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 |
String?: a String, or null |
value |
Array<String!>?: a String array object, or null |
remove
open fun remove(key: String!): Unit
Removes any entry with the given key from the mapping of this Bundle.
| Parameters | |
|---|---|
key |
String!: a String key |
size
open fun size(): Int
Returns the number of mappings contained in this Bundle.
| Return | |
|---|---|
Int |
the number of mappings as an int. |