共用方式為


Bundle Class

Definition

A mapping from String keys to various Parcelable values.

[Android.Runtime.Register("android/os/Bundle", DoNotGenerateAcw=true)]
public sealed class Bundle : Android.OS.BaseBundle, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.ICloneable
[<Android.Runtime.Register("android/os/Bundle", DoNotGenerateAcw=true)>]
type Bundle = class
    inherit BaseBundle
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ICloneable
Inheritance
Attributes
Implements

Remarks

A mapping from String keys to various Parcelable values.

<b>Warning:</b> Note that Bundle is a lazy container and as such it does NOT implement #equals(Object) or #hashCode().

Java documentation for android.os.Bundle.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Bundle()

Constructs a new, empty Bundle.

Bundle(Bundle)

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

Bundle(ClassLoader)

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

Bundle(Int32)

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

Bundle(PersistableBundle)

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

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
ClassLoader

Return the ClassLoader currently associated with this Bundle.

Creator
Empty

An unmodifiable Bundle that is always #isEmpty() empty.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasFileDescriptors

Reports whether the bundle contains any parcelled file descriptors.

IsEmpty

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

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from BaseBundle)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from BaseBundle)

Methods

Clear()

Removes all elements from the mapping of this Bundle.

Clone()

Clones the current Bundle.

ContainsKey(String)

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

DeepCopy()

Make a deep copy of the given bundle.

DescribeContents()

Report the nature of this Parcelable's contents

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Get(String)
Obsolete.

Returns the entry with the given key as an object.

GetBinder(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.

GetBoolean(String, Boolean)

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

GetBoolean(String)

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

GetBooleanArray(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.

GetBundle(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.

GetByte(String, SByte)

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

GetByte(String)

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

GetByteArray(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.

GetChar(String, Char)

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

GetChar(String)

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

GetCharArray(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.

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

GetCharSequence(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.

GetCharSequenceArray(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.

GetCharSequenceArrayFormatted(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.

GetCharSequenceArrayList(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.

GetCharSequenceFormatted(String, ICharSequence)

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.

GetCharSequenceFormatted(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.

GetDouble(String, Double)

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

GetDouble(String)

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

GetDoubleArray(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.

GetFloat(String, Single)

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

GetFloat(String)

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

GetFloatArray(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.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInt(String, Int32)

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

GetInt(String)

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

GetIntArray(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.

GetIntegerArrayList(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.

GetLong(String, Int64)

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

GetLong(String)

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

GetLongArray(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.

GetParcelable(String, Class)

Returns the value associated with the given key or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetParcelable(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.

GetParcelableArray(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetParcelableArray(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.

GetParcelableArrayList(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetParcelableArrayList(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.

GetSerializable(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetSerializable(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.

GetShort(String, Int16)

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

GetShort(String)

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

GetShortArray(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.

GetSize(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.

GetSizeF(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.

GetSparseParcelableArray(String, Class)

Returns the value associated with the given key, or null if: <ul> <li>No mapping of the desired type exists for the given key.

GetSparseParcelableArray(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.

GetString(String, String)

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

GetString(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.

GetStringArray(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.

GetStringArrayList(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.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
KeySet()

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

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PutAll(Bundle)

Inserts all mappings from the given Bundle into this Bundle.

PutAll(PersistableBundle)

Inserts all mappings from the given PersistableBundle into this BaseBundle.

(Inherited from BaseBundle)
PutBinder(String, IBinder)

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

PutBoolean(String, Boolean)

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

PutBooleanArray(String, Boolean[])

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

PutBundle(String, Bundle)

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

PutByte(String, SByte)

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

PutByteArray(String, Byte[])

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

PutChar(String, Char)

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

PutCharArray(String, Char[])

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

PutCharSequence(String, ICharSequence)

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

PutCharSequence(String, String)

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

PutCharSequenceArray(String, ICharSequence[])

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

PutCharSequenceArray(String, String[])

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

PutCharSequenceArrayList(String, IList<ICharSequence>)

Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing any existing value for the given key.

PutDouble(String, Double)

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

PutDoubleArray(String, Double[])

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

PutFloat(String, Single)

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

PutFloatArray(String, Single[])

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

PutInt(String, Int32)

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

PutIntArray(String, Int32[])

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

PutIntegerArrayList(String, IList<Integer>)

Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing any existing value for the given key.

PutLong(String, Int64)

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

PutLongArray(String, Int64[])

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

PutParcelable(String, IParcelable)

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

PutParcelableArray(String, IParcelable[])

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

PutParcelableArrayList(String, IList<IParcelable>)

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

PutSerializable(String, ISerializable)

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

PutShort(String, Int16)

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

PutShortArray(String, Int16[])

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

PutSize(String, Size)

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

PutSizeF(String, SizeF)

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

PutSparseParcelableArray(String, SparseArray)

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

PutString(String, String)

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

PutStringArray(String, String[])

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

PutStringArrayList(String, IList<String>)

Inserts an ArrayList<String> value into the mapping of this Bundle, replacing any existing value for the given key.

ReadFromParcel(Parcel)

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

Remove(String)

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

SetClassLoader(ClassLoader)

Changes the ClassLoader this Bundle uses when instantiating objects.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Size()

Returns the number of mappings contained in this Bundle.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

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

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to