Android Parcelable Create parcelableFromByteArray( Parcelable.Creator creator, byte[] byteArray)

Here you can find the source of parcelableFromByteArray( Parcelable.Creator creator, byte[] byteArray)

Description

parcelable From Byte Array

License

Apache License

Declaration

public static <T extends Parcelable> T parcelableFromByteArray(
            Parcelable.Creator<T> creator, byte[] byteArray) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.os.Parcel;
import android.os.Parcelable;

public class Main {
    public static <T extends Parcelable> T parcelableFromByteArray(
            Parcelable.Creator<T> creator, byte[] byteArray) {
        Parcel obtain = Parcel.obtain();
        obtain.unmarshall(byteArray, 0, byteArray.length);
        obtain.setDataPosition(0);/*from   w w  w .j a  va 2 s  .c  o  m*/
        T createFromParcel = creator.createFromParcel(obtain);
        obtain.recycle();
        return createFromParcel;
    }
}

Related

  1. arrayToByteArray(ContentValues[] contentValues)