Java tutorial
//package com.java2s; /* * Copyright (C) 2014 Ingenic Semiconductor * * SunWenZhong(Fighter) <wenzhong.sun@ingenic.com, wanmyqawdr@126.com> * * Elf/IDWS Project * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. * */ import android.os.Parcel; import android.os.Parcelable; public class Main { public static byte[] marshall(Parcelable parcelable) { Parcel parcel = Parcel.obtain(); parcelable.writeToParcel(parcel, 0); byte[] bytes = parcel.marshall(); parcel.recycle(); return bytes; } }