Skip to content

Instantly share code, notes, and snippets.

@lenamuit
Created July 21, 2014 15:23
Show Gist options
  • Select an option

  • Save lenamuit/e771dc8d52557f394da2 to your computer and use it in GitHub Desktop.

Select an option

Save lenamuit/e771dc8d52557f394da2 to your computer and use it in GitHub Desktop.
MyParcelable
public class MyParcelable implements Parcelable {
private int mData;
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel out, int flags) {
out.writeInt(mData);
}
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[size];
}
};
private MyParcelable(Parcel in) {
mData = in.readInt();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment