Parcel.WriteValue(Object) Method

Definition

Flatten a generic object in to a parcel.

[Android.Runtime.Register("writeValue", "(Ljava/lang/Object;)V", "")]
public void WriteValue (Java.Lang.Object? v);
[<Android.Runtime.Register("writeValue", "(Ljava/lang/Object;)V", "")>]
member this.WriteValue : Java.Lang.Object -> unit

Parameters

v
Object
Attributes

Remarks

Flatten a generic object in to a parcel. The given Object value may currently be one of the following types:

<ul> <li> null <li> String <li> Byte <li> Short <li> Integer <li> Long <li> Float <li> Double <li> Boolean <li> String[] <li> boolean[] <li> byte[] <li> int[] <li> long[] <li> Object[] (supporting objects of the same type defined here). <li> Bundle<li> Map (as supported by #writeMap). <li> Any object that implements the Parcelable protocol. <li> Parcelable[] <li> CharSequence (as supported by TextUtils#writeToParcel). <li> List (as supported by #writeList). <li> SparseArray (as supported by #writeSparseArray(SparseArray)). <li> IBinder<li> Any object that implements Serializable (but see #writeSerializable for caveats). Note that all of the previous types have relatively efficient implementations for writing to a Parcel; having to rely on the generic serialization approach is much less efficient and should be avoided whenever possible. </ul>

<p class="caution">Parcelable objects are written with Parcelable#writeToParcel using contextual flags of 0. When serializing objects containing ParcelFileDescriptors, this may result in file descriptor leaks when they are returned from Binder calls (where Parcelable#PARCELABLE_WRITE_RETURN_VALUE should be used).</p>

Java documentation for android.os.Parcel.writeValue(java.lang.Object).

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.

Applies to