public final class PersistableBundle
extends BaseBundle implements Cloneable, Parcelable
| java.lang.Object | ||
| android.os.BaseBundle | ||
| android.os.PersistableBundle | ||
从字符串键到各种类型值的映射。 这个类支持的类型集合有意限制在可以安全地保存到磁盘并从磁盘恢复的简单对象上。
也可以看看:
Inherited constants |
|---|
android.os.Parcelable
|
Fields |
|
|---|---|
public static final Creator<PersistableBundle> |
CREATOR |
public static final PersistableBundle |
EMPTY |
Public constructors |
|
|---|---|
PersistableBundle() 构造一个新的,空的PersistableBundle。 |
|
PersistableBundle(int capacity) 构造一个新的,空的PersistableBundle,其大小保持给定数量的元素。 |
|
PersistableBundle(PersistableBundle b) 构造一个PersistableBundle,其中包含来自给定PersistableBundle的映射副本。 |
|
公共方法(Public methods) |
|
|---|---|
Object |
clone() 克隆当前的PersistableBundle。 |
int |
describeContents() 报告这个Parcelable内容的性质 |
PersistableBundle |
getPersistableBundle(String key) 返回与给定键相关联的值;如果没有给定键的所需类型的映射存在,或者null键与该键明确关联,则返回null。 |
void |
putPersistableBundle(String key, PersistableBundle value) 将PersistableBundle值插入此Bundle的映射中,替换给定键的任何现有值。 |
String |
toString() 返回对象的字符串表示形式。 |
void |
writeToParcel(Parcel parcel, int flags) 将PersistableBundle内容写入Parcel,通常是为了使其通过IBinder连接传递。 |
继承方法(Inherited methods) |
|
|---|---|
android.os.BaseBundle
|
|
java.lang.Object
|
|
android.os.Parcelable
|
|
PersistableBundle (int capacity)
构造一个新的,空的PersistableBundle,其大小保持给定数量的元素。 PersistableBundle将根据需要增长。
| 参数(Parameters) | |
|---|---|
capacity |
int: the initial capacity of the PersistableBundle |
PersistableBundle (PersistableBundle b)
构造一个PersistableBundle,其中包含来自给定PersistableBundle的映射副本。
| 参数(Parameters) | |
|---|---|
b |
PersistableBundle: a PersistableBundle to be copied. |
Object clone ()
克隆当前的PersistableBundle。 内部映射是克隆的,但它引用的键和值是通过引用复制的。
| 返回(Returns) | |
|---|---|
Object |
a clone of this instance. |
int describeContents ()
报告这个Parcelable内容的性质
| 返回(Returns) | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
PersistableBundle getPersistableBundle (String key)
返回与给定键相关联的值;如果没有给定键的所需类型的映射存在,或者null键与该键明确关联,则返回null。
| 参数(Parameters) | |
|---|---|
key |
String: a String, or null |
| 返回(Returns) | |
|---|---|
PersistableBundle |
a Bundle value, or null |
void putPersistableBundle (String key, PersistableBundle value)
将PersistableBundle值插入此Bundle的映射中,替换给定键的任何现有值。 键或值都可以为空。
| 参数(Parameters) | |
|---|---|
key |
String: a String, or null |
value |
PersistableBundle: a Bundle object, or null |
String toString ()
返回对象的字符串表示形式。 通常, toString方法会返回一个字符串,用于“文本地表示”此对象。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object的toString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”和对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
| 返回(Returns) | |
|---|---|
String |
a string representation of the object. |
void writeToParcel (Parcel parcel, int flags)
将PersistableBundle内容写入Parcel,通常是为了使其通过IBinder连接传递。
| 参数(Parameters) | |
|---|---|
parcel |
Parcel: The parcel to copy this bundle to. |
flags |
int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. |