Java tutorial
//package com.java2s; //License from project: Open Source License import android.os.Parcel; import android.os.Parcelable; public class Main { public static byte[] serialize(Parcelable parceable) { Parcel parcel = Parcel.obtain(); parceable.writeToParcel(parcel, 0); byte[] bytes = parcel.marshall(); parcel.recycle(); return bytes; } }