ParcelUtil

object ParcelUtil

Contains a set of methods to handle Parcelable.

Functions

Link copied to clipboard
fun marshall(parcelable: Parcelable): ByteArray

Marshalls the provided Parcelable i.e. returns a byte array representation of the Parcelable. Do not persist the marshalled Parcelable. Also, if used for IPC, make sure both applications have the same version of the Objects in the Parcelable.

Link copied to clipboard
fun unmarshall(data: ByteArray): Parcel

Unmarshall a byte array, previously generated with ParcelUtil.marshall. Note: Do not forget to call Parcel.recycle, after you are done with the Parcel.

fun <T> unmarshall(data: ByteArray, creator: Parcelable.Creator<T>): T

Recreates a Parcelable that was previously marshalled.

Properties

Link copied to clipboard
const val NONNULL_ELEMENT_FLAG: Int = 1
Link copied to clipboard
const val NULL_ELEMENT_FLAG: Int = 0