Added in API level 1

Bundle


class Bundle : BaseBundle, Cloneable, Parcelable
kotlin.Any
   ↳ android.os.BaseBundle
   ↳ android.os.Bundle

A mapping from String keys to various Parcelable values.

Warning: Note that Bundle is a lazy container and as such it does NOT implement equals(java.lang.Object) or hashCode().

Summary

Inherited constants
Public constructors

Constructs a new, empty Bundle.

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

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

Bundle(capacity: Int)

Constructs a new, empty Bundle sized to hold the given number of elements.

Bundle(loader: ClassLoader!)

Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects.

Public methods
Unit

Removes all elements from the mapping of this Bundle.

Any

Clones the current Bundle.

Bundle!

Make a deep copy of the given bundle.

Int

Report the nature of this Parcelable's contents

IBinder?

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?

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

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(key: String!, defaultValue: Byte)

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

ByteArray?

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

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(key: String!, defaultValue: Char)

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

CharArray?

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.

CharSequence?

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.

CharSequence!
getCharSequence(key: String?, defaultValue: CharSequence!)

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 associatd with the given key.

Array<CharSequence!>?

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<CharSequence!>?

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.

ClassLoader!

Return the ClassLoader currently associated with this Bundle.

Float

Returns the value associated with the given key, or 0.

Float
getFloat(key: String!, defaultValue: Float)

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

FloatArray?

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<Int!>?

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.

T?

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.

T?
getParcelable(key: String?, clazz: Class<T>)

Returns the value associated with the given key or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Array<Parcelable!>?

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.

Array<T>?
getParcelableArray(key: String?, clazz: Class<T>)

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

ArrayList<T>?

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<T>?
getParcelableArrayList(key: String?, clazz: Class<out T>)

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Serializable?

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.

T?
getSerializable(key: String?, clazz: Class<T>)

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Short

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(key: String!, defaultValue: Short)

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

ShortArray?

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.

Size?
getSize(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.

SizeF?

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.

SparseArray<T>?

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.

SparseArray<T>?
getSparseParcelableArray(key: String?, clazz: Class<out T>)

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

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

Boolean

Reports whether the bundle contains any parcelled file descriptors.

Unit
putAll(bundle: Bundle!)

Inserts all mappings from the given Bundle into this Bundle.

Unit
putBinder(key: String?, value: IBinder?)

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

Unit
putBundle(key: String?, value: Bundle?)

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

Unit
putByte(key: String?, value: Byte)

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

Unit
putByteArray(key: String?, value: ByteArray?)

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

Unit
putChar(key: String?, value: Char)

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

Unit
putCharArray(key: String?, value: CharArray?)

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

Unit

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

Unit

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

Unit

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.

Unit
putFloat(key: String?, value: Float)

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

Unit
putFloatArray(key: String?, value: FloatArray?)

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

Unit

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.

Unit
putParcelable(key: String?, value: Parcelable?)

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

Unit

Inserts an array of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

Unit

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

Unit

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

Unit
putShort(key: String?, value: Short)

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

Unit
putShortArray(key: String?, value: ShortArray?)

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

Unit
putSize(key: String?, value: Size?)

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

Unit
putSizeF(key: String?, value: SizeF?)

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

Unit

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

Unit

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.

Unit

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

Unit
remove(key: String!)

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

Unit

Changes the ClassLoader this Bundle uses when instantiating objects.

String

Returns a string representation of the Bundle that may be suitable for debugging.

Unit
writeToParcel(parcel: Parcel, flags: Int)

Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.

Inherited functions
Properties
static Parcelable.Creator<Bundle!>

static Bundle!

An unmodifiable Bundle that is always empty.

Public constructors

Bundle

Added in API level 1
Bundle()

Constructs a new, empty Bundle.

Bundle

Added in API level 1
Bundle(b: Bundle!)

Constructs a Bundle containing a copy of the mappings from the given Bundle. Does only a shallow copy of the original Bundle -- see deepCopy() if that is not what you want.

Parameters
b Bundle!: a Bundle to be copied.

See Also

Bundle

Added in API level 21
Bundle(b: PersistableBundle!)

Constructs a Bundle containing a copy of the mappings from the given PersistableBundle. Does only a shallow copy of the PersistableBundle -- see PersistableBundle.deepCopy() if you don't want that.

Parameters
b PersistableBundle!: a PersistableBundle to be copied.

Bundle

Added in API level 1
Bundle(capacity: Int)

Constructs a new, empty Bundle sized to hold the given number of elements. The Bundle will grow as needed.

Parameters
capacity Int: the initial capacity of the Bundle

Bundle

Added in API level 1
Bundle(loader: ClassLoader!)

Constructs a new, empty Bundle that uses a specific ClassLoader for instantiating Parcelable and Serializable objects.

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

Public methods

clear

Added in API level 1
fun clear(): Unit

Removes all elements from the mapping of this Bundle.

clone

Added in API level 1
fun clone(): Any

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

Return
Any a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

deepCopy

Added in API level 26
fun deepCopy(): Bundle!

Make a deep copy of the given bundle. Traverses into inner containers and copies them as well, so they are not shared across bundles. Will traverse in to Bundle, PersistableBundle, ArrayList, and all types of primitive arrays. Other types of objects (such as Parcelable or Serializable) are referenced as-is and not copied in any way.

describeContents

Added in API level 1
fun describeContents(): Int

Report the nature of this Parcelable's contents

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getBinder

Added in API level 18
fun getBinder(key: String?): IBinder?

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
IBinder? an IBinder value, or null

getBundle

Added in API level 1
fun getBundle(key: String?): Bundle?

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
Bundle? a Bundle value, or null

getByte

Added in API level 1
fun getByte(key: String!): Byte

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 String!: a String
Return
Byte a byte value

getByte

Added in API level 1
fun getByte(
    key: String!,
    defaultValue: Byte
): Byte!

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 Byte: Value to return if key does not exist
Return
Byte! a byte value

getByteArray

Added in API level 1
fun getByteArray(key: String?): ByteArray?

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

getChar

Added in API level 1
fun getChar(key: String!): Char

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 String!: a String
Return
Char a char value

getChar

Added in API level 1
fun getChar(
    key: String!,
    defaultValue: Char
): Char

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 Char: Value to return if key does not exist
Return
Char a char value

getCharArray

Added in API level 1
fun getCharArray(key: String?): CharArray?

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

getCharSequence

Added in API level 1
fun getCharSequence(key: String?): CharSequence?

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
CharSequence? a CharSequence value, or null

getCharSequence

Added in API level 12
fun getCharSequence(
    key: String?,
    defaultValue: CharSequence!
): CharSequence!

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 associatd with the given key.

Parameters
key String?: a String, or null
defaultValue CharSequence!: Value to return if key does not exist or if a null value is associated with the given key.
Return
CharSequence! the CharSequence value associated with the given key, or defaultValue if no valid CharSequence object is currently mapped to that key.

getCharSequenceArray

Added in API level 8
fun getCharSequenceArray(key: String?): Array<CharSequence!>?

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<CharSequence!>? a CharSequence[] value, or null

getCharSequenceArrayList

Added in API level 8
fun getCharSequenceArrayList(key: String?): ArrayList<CharSequence!>?

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
ArrayList<CharSequence!>? an ArrayList value, or null

getClassLoader

Added in API level 11
fun getClassLoader(): ClassLoader!

Return the ClassLoader currently associated with this Bundle.

getFloat

Added in API level 1
fun getFloat(key: String!): Float

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 String!: a String
Return
Float a float value

getFloat

Added in API level 1
fun getFloat(
    key: String!,
    defaultValue: Float
): Float

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 Float: Value to return if key does not exist
Return
Float a float value

getFloatArray

Added in API level 1
fun getFloatArray(key: String?): FloatArray?

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

getIntegerArrayList

Added in API level 1
fun getIntegerArrayList(key: String?): ArrayList<Int!>?

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
ArrayList<Int!>? an ArrayList value, or null

getParcelable

Added in API level 1
Deprecated in API level 33
fun <T : Parcelable!> getParcelable(key: String?): T?

Deprecated: Use the type-safer getParcelable(java.lang.String,java.lang.Class) starting from Android Build.VERSION_CODES.TIRAMISU.

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.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Parameters
key String?: a String, or null
Return
T? a Parcelable value, or null

getParcelable

Added in API level 33
fun <T : Any!> getParcelable(
    key: String?,
    clazz: Class<T>
): T?

Returns the value associated with the given key or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Warning: the class that implements Parcelable has to be the immediately enclosing class of the runtime type of its CREATOR field (that is, Class.getEnclosingClass() has to return the parcelable implementing class), otherwise this method might throw an exception. If the Parcelable class does not enclose the CREATOR, use the deprecated getParcelable(java.lang.String) instead.

Parameters
key String?: a String, or null
clazz Class<T>: The type of the object expected This value cannot be null.
Return
T? a Parcelable value, or null

getParcelableArray

Added in API level 1
Deprecated in API level 33
fun getParcelableArray(key: String?): Array<Parcelable!>?

Deprecated: Use the type-safer getParcelableArray(java.lang.String,java.lang.Class) starting from Android Build.VERSION_CODES.TIRAMISU.

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.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Parameters
key String?: a String, or null
Return
Array<Parcelable!>? a Parcelable[] value, or null

getParcelableArray

Added in API level 33
fun <T : Any!> getParcelableArray(
    key: String?,
    clazz: Class<T>
): Array<T>?

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Warning: if the list contains items implementing the Parcelable interface, the class that implements Parcelable has to be the immediately enclosing class of the runtime type of its CREATOR field (that is, Class.getEnclosingClass() has to return the parcelable implementing class), otherwise this method might throw an exception. If the Parcelable class does not enclose the CREATOR, use the deprecated getParcelableArray(java.lang.String) instead.

Parameters
key String?: a String, or null
clazz Class<T>: The type of the items inside the array. This is only verified when unparceling. This value cannot be null.
Return
Array<T>? a Parcelable[] value, or null

getParcelableArrayList

Added in API level 1
Deprecated in API level 33
fun <T : Parcelable!> getParcelableArrayList(key: String?): ArrayList<T>?

Deprecated: Use the type-safer getParcelable(java.lang.String,java.lang.Class) starting from Android Build.VERSION_CODES.TIRAMISU.

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.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Parameters
key String?: a String, or null
Return
ArrayList<T>? an ArrayList value, or null

getParcelableArrayList

Added in API level 33
fun <T : Any!> getParcelableArrayList(
    key: String?,
    clazz: Class<out T>
): ArrayList<T>?

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Note: if the expected value is not a class provided by the Android platform, you must call setClassLoader(java.lang.ClassLoader) with the proper ClassLoader first. Otherwise, this method might throw an exception or return null.

Warning: if the list contains items implementing the Parcelable interface, the class that implements Parcelable has to be the immediately enclosing class of the runtime type of its CREATOR field (that is, Class.getEnclosingClass() has to return the parcelable implementing class), otherwise this method might throw an exception. If the Parcelable class does not enclose the CREATOR, use the deprecated getParcelableArrayList(java.lang.String) instead.

Parameters
key String?: a String, or null
clazz Class<out T>: The type of the items inside the array list. This is only verified when unparceling. This value cannot be null.
Return
ArrayList<T>? an ArrayList value, or null

getSerializable

Added in API level 1
Deprecated in API level 33
fun getSerializable(key: String?): Serializable?

Deprecated: Use the type-safer getSerializable(java.lang.String,java.lang.Class) starting from Android Build.VERSION_CODES.TIRAMISU.

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
Serializable? a Serializable value, or null

getSerializable

Added in API level 33
fun <T : Serializable!> getSerializable(
    key: String?,
    clazz: Class<T>
): T?

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Parameters
key String?: a String, or null
clazz Class<T>: The expected class of the returned type This value cannot be null.
Return
T? a Serializable value, or null

getShort

Added in API level 1
fun getShort(key: String!): Short

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 String!: a String
Return
Short a short value

getShort

Added in API level 1
fun getShort(
    key: String!,
    defaultValue: Short
): Short

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 Short: Value to return if key does not exist
Return
Short a short value

getShortArray

Added in API level 1
fun getShortArray(key: String?): ShortArray?

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

getSize

Added in API level 21
fun getSize(key: String?): Size?

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
Size? a Size value, or null

getSizeF

Added in API level 21
fun getSizeF(key: String?): SizeF?

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
SizeF? a Size value, or null

getSparseParcelableArray

Added in API level 1
Deprecated in API level 33
fun <T : Parcelable!> getSparseParcelableArray(key: String?): SparseArray<T>?

Deprecated: Use the type-safer getSparseParcelableArray(java.lang.String,java.lang.Class) starting from Android Build.VERSION_CODES.TIRAMISU.

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
SparseArray<T>? a SparseArray of T values, or null

getSparseParcelableArray

Added in API level 33
fun <T : Any!> getSparseParcelableArray(
    key: String?,
    clazz: Class<out T>
): SparseArray<T>?

Returns the value associated with the given key, or null if:

  • No mapping of the desired type exists for the given key.
  • A null value is explicitly associated with the key.
  • The object is not of type clazz.

Warning: if the list contains items implementing the Parcelable interface, the class that implements Parcelable has to be the immediately enclosing class of the runtime type of its CREATOR field (that is, Class.getEnclosingClass() has to return the parcelable implementing class), otherwise this method might throw an exception. If the Parcelable class does not enclose the CREATOR, use the deprecated getSparseParcelableArray(java.lang.String) instead.

Parameters
key String?: a String, or null
clazz Class<out T>: The type of the items inside the sparse array. This is only verified when unparceling. This value cannot be null.
Return
SparseArray<T>? a SparseArray of T values, or null

getStringArrayList

Added in API level 1
fun getStringArrayList(key: String?): ArrayList<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
ArrayList<String!>? an ArrayList value, or null

hasFileDescriptors

Added in API level 1
fun hasFileDescriptors(): Boolean

Reports whether the bundle contains any parcelled file descriptors.

putAll

Added in API level 1
fun putAll(bundle: Bundle!): Unit

Inserts all mappings from the given Bundle into this Bundle.

Parameters
bundle Bundle!: a Bundle

putBinder

Added in API level 18
fun putBinder(
    key: String?,
    value: IBinder?
): Unit

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 String?: a String, or null
value IBinder?: an IBinder object, or null

putBundle

Added in API level 1
fun putBundle(
    key: String?,
    value: Bundle?
): Unit

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 String?: a String, or null
value Bundle?: a Bundle object, or null

putByte

Added in API level 1
fun putByte(
    key: String?,
    value: Byte
): Unit

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

Parameters
key String?: a String, or null
value Byte: a byte

putByteArray

Added in API level 1
fun putByteArray(
    key: String?,
    value: ByteArray?
): Unit

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 String?: a String, or null
value ByteArray?: a byte array object, or null

putChar

Added in API level 1
fun putChar(
    key: String?,
    value: Char
): Unit

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

Parameters
key String?: a String, or null
value Char: a char

putCharArray

Added in API level 1
fun putCharArray(
    key: String?,
    value: CharArray?
): Unit

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 String?: a String, or null
value CharArray?: a char array object, or null

putCharSequence

Added in API level 1
fun putCharSequence(
    key: String?,
    value: CharSequence?
): Unit

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 String?: a String, or null
value CharSequence?: a CharSequence, or null

putCharSequenceArray

Added in API level 8
fun putCharSequenceArray(
    key: String?,
    value: Array<CharSequence!>?
): Unit

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 String?: a String, or null
value Array<CharSequence!>?: a CharSequence array object, or null

putCharSequenceArrayList

Added in API level 8
fun putCharSequenceArrayList(
    key: String?,
    value: ArrayList<CharSequence!>?
): Unit

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 String?: a String, or null
value ArrayList<CharSequence!>?: an ArrayList object, or null

putFloat

Added in API level 1
fun putFloat(
    key: String?,
    value: Float
): Unit

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

Parameters
key String?: a String, or null
value Float: a float

putFloatArray

Added in API level 1
fun putFloatArray(
    key: String?,
    value: FloatArray?
): Unit

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 String?: a String, or null
value FloatArray?: a float array object, or null

putIntegerArrayList

Added in API level 1
fun putIntegerArrayList(
    key: String?,
    value: ArrayList<Int!>?
): Unit

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 String?: a String, or null
value ArrayList<Int!>?: an ArrayList object, or null

putParcelable

Added in API level 1
fun putParcelable(
    key: String?,
    value: Parcelable?
): Unit

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 String?: a String, or null
value Parcelable?: a Parcelable object, or null

putParcelableArray

Added in API level 1
fun putParcelableArray(
    key: String?,
    value: Array<Parcelable!>?
): Unit

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 String?: a String, or null
value Array<Parcelable!>?: an array of Parcelable objects, or null

putParcelableArrayList

Added in API level 1
fun putParcelableArrayList(
    key: String?,
    value: ArrayList<out Parcelable!>?
): Unit

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 String?: a String, or null
value ArrayList<out Parcelable!>?: an ArrayList of Parcelable objects, or null

putSerializable

Added in API level 1
fun putSerializable(
    key: String?,
    value: Serializable?
): Unit

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 String?: a String, or null
value Serializable?: a Serializable object, or null

putShort

Added in API level 1
fun putShort(
    key: String?,
    value: Short
): Unit

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

Parameters
key String?: a String, or null
value Short: a short

putShortArray

Added in API level 1
fun putShortArray(
    key: String?,
    value: ShortArray?
): Unit

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 String?: a String, or null
value ShortArray?: a short array object, or null

putSize

Added in API level 21
fun putSize(
    key: String?,
    value: Size?
): Unit

Inserts a Size 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 Size?: a Size object, or null

putSizeF

Added in API level 21
fun putSizeF(
    key: String?,
    value: SizeF?
): Unit

Inserts a SizeF 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 SizeF?: a SizeF object, or null

putSparseParcelableArray

Added in API level 1
fun putSparseParcelableArray(
    key: String?,
    value: SparseArray<out Parcelable!>?
): Unit

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 String?: a String, or null
value SparseArray<out Parcelable!>?: a SparseArray of Parcelable objects, or null

putStringArrayList

Added in API level 1
fun putStringArrayList(
    key: String?,
    value: ArrayList<String!>?
): Unit

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 String?: a String, or null
value ArrayList<String!>?: an ArrayList object, or null

readFromParcel

Added in API level 1
fun readFromParcel(parcel: Parcel!): Unit

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

Parameters
parcel Parcel!: The parcel to overwrite this bundle from.

remove

Added in API level 1
fun remove(key: String!): Unit

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

Parameters
key String!: a String key

setClassLoader

Added in API level 1
fun setClassLoader(loader: ClassLoader!): Unit

Changes the ClassLoader this Bundle uses when instantiating objects.

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

toString

Added in API level 1
fun toString(): String

Returns a string representation of the Bundle that may be suitable for debugging. It won't print the internal map if its content hasn't been unparcelled.

Return
String a string representation of the object.

writeToParcel

Added in API level 1
fun writeToParcel(
    parcel: Parcel,
    flags: Int
): Unit

Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.

Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES
parcel Parcel: The parcel to copy this bundle to.

Properties

CREATOR

Added in API level 1
static val CREATOR: Parcelable.Creator<Bundle!>

EMPTY

Added in API level 1
static val EMPTY: Bundle!

An unmodifiable Bundle that is always empty.