mutate via Parcel - Android android.os

Android examples for android.os:Parcel

Description

mutate via Parcel

Demo Code

import android.os.Bundle;
import android.os.Parcel;

public class Main {

  public static Bundle mutate(Bundle bundle) {

    if (bundle == null) {
      return null;
    }/*from   ww w .  j a va2  s .c o m*/

    final Parcel in = Parcel.obtain();
    in.writeBundle(bundle);
    final byte[] bytes = in.marshall();

    final Parcel out = Parcel.obtain();
    out.unmarshall(bytes, 0, bytes.length);
    out.setDataPosition(0);

    try {
      return out.readBundle();
    } finally {
      in.recycle();
      out.recycle();
    }
  }

}

Related Tutorials