Java tutorial
//package com.java2s; //License from project: Apache License import android.os.Parcel; import android.os.Parcelable; public class Main { private static <T> T bytes2Parcelable(final byte[] bytes, final Parcelable.Creator<T> creator) { if (bytes == null) return null; Parcel parcel = Parcel.obtain(); parcel.unmarshall(bytes, 0, bytes.length); parcel.setDataPosition(0); T result = creator.createFromParcel(parcel); parcel.recycle(); return result; } }