Android APIs
public final class

PersistableBundle

extends BaseBundle
implements Parcelable Cloneable
java.lang.Object
   ↳ android.os.BaseBundle
     ↳ android.os.PersistableBundle

Class Overview

A mapping from String values to various types that can be saved to persistent and later restored.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<PersistableBundle> CREATOR
public static final PersistableBundle EMPTY
Public Constructors
PersistableBundle()
Constructs a new, empty PersistableBundle.
PersistableBundle(int capacity)
Constructs a new, empty PersistableBundle sized to hold the given number of elements.
PersistableBundle(PersistableBundle b)
Constructs a PersistableBundle containing a copy of the mappings from the given PersistableBundle.
Public Methods
Object clone()
Clones the current PersistableBundle.
int describeContents()
Report the nature of this Parcelable's contents
PersistableBundle getPersistableBundle(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.
void putPersistableBundle(String key, PersistableBundle value)
Inserts a PersistableBundle value into the mapping of this Bundle, replacing any existing value for the given key.
synchronized String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel parcel, int flags)
Writes the PersistableBundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
[Expand]
Inherited Methods
From class android.os.BaseBundle
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<PersistableBundle> CREATOR

public static final PersistableBundle EMPTY

Public Constructors

public PersistableBundle ()

Constructs a new, empty PersistableBundle.

public PersistableBundle (int capacity)

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

Parameters
capacity the initial capacity of the PersistableBundle

public PersistableBundle (PersistableBundle b)

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

Parameters
b a PersistableBundle to be copied.

Public Methods

public Object clone ()

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

Returns
  • a copy of this object.

public int describeContents ()

Report the nature of this Parcelable's contents

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public PersistableBundle getPersistableBundle (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 void putPersistableBundle (String key, PersistableBundle value)

Inserts a PersistableBundle 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 synchronized String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel parcel, int flags)

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

Parameters
parcel The parcel to copy this bundle to.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.