Android Parcelable.

| Page Views: 243

Parcelable is an interface that allows its implementers to be writable to and restorable from a parcel.

A parcel is a class that acts as a holder for both data and IBinder objects that can be sent through an IBinder.

Parcelable has existed in the android framework all the way since API level 1.

Pareclable Interface Definition

Parcelable is an interface hence it's implemented and not directly instantiated.

public interface Parcelable{}

Parcelable resides in the android.os package:

package android.os


  1. Allows for the placement of arbitrary objects into a Parcel.


As an interfacce Parcelable has to be implemented by classes.

Those classes must have a non-null static field called CREATOR. This field is of data type that implements Parcelable.Creator.

Here's an example:

 public class MyParcelable implements Parcelable {
     private int mData;

     public int describeContents() {
         return 0;

     public void writeToParcel(Parcel out, int flags) {

     public static final Parcelable.Creator<MyParcelable> CREATOR
             = new Parcelable.Creator<MyParcelable>() {
         public MyParcelable createFromParcel(Parcel in) {
             return new MyParcelable(in);

         public MyParcelable[] newArray(int size) {
             return new MyParcelable;

     private MyParcelable(Parcel in) {
         mData = in.readInt();

How do You Feel after reading this?

According to scientists, we humans have 8 primary innate emotions: joy, acceptance, fear, surprise, sadness, disgust, anger, and anticipation. Feel free to tell us how you feel about this article using these emotes or via the comment section.

About Me.

After completing his Software Engineering bachelors program, Oclemy(Clement Ochieng) these days is a man of two lives. At day he works for a startup in Nairobi, Kenya. At night he works tirelessly on building ProgrammingWizards TV, a tv channel for student coders and this website to help share the source code. In between he practices Meditation and Self actualization to help him keep balance. He also likes going for long solo walks to connect more with nature.


What do You Think

Previous Post Next Post