Added in API level 21

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

Removes all elements from the mapping of this Bundle.

open Boolean

Returns true if the given key is contained in the mapping of this Bundle.

open Any?
get(key: String!)

Returns the entry with the given key as an object.

open Boolean

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?

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
getDouble(key: String!, defaultValue: 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?

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
getInt(key: String!)

Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

open Int
getInt(key: String!, defaultValue: 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?

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
getLong(key: String!)

Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.

open Long
getLong(key: String!, defaultValue: 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?

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!
getString(key: String?, defaultValue: 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!>?

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

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

open MutableSet<String!>!

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

open Unit

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

Inserts a boolean array value into the mapping of this Bundle, replacing any existing value for the given key.

open Unit
putDouble(key: String?, value: Double)

Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.

open Unit

Inserts a double array value into the mapping of this Bundle, replacing any existing value for the given key.

open Unit
putInt(key: String?, value: Int)

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
putLong(key: String?, value: Long)

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
putString(key: String?, value: String?)

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
remove(key: String!)

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

open Int

Returns the number of mappings contained in this Bundle.

Public methods

clear

Added in API level 21
open fun clear(): Unit

Removes all elements from the mapping of this Bundle. Recycles the underlying parcel if it is still present.

containsKey

Added in API level 21
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

Added in API level 21
Deprecated in API level 33
open fun get(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

Added in API level 22
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

Added in API level 22
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

Added in API level 22
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
open fun isEmpty(): Boolean

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

keySet

Added in API level 21
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

Added in API level 21
open fun putAll(bundle: PersistableBundle!): Unit

Inserts all mappings from the given PersistableBundle into this BaseBundle.

Parameters
bundle PersistableBundle!: a PersistableBundle

putBoolean

Added in API level 22
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

Added in API level 22
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
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

Added in API level 21
open fun size(): Int

Returns the number of mappings contained in this Bundle.

Return
Int the number of mappings as an int.