Skip to content

Instantly share code, notes, and snippets.

@oguya
Created February 15, 2014 03:07
Show Gist options
  • Save oguya/9013995 to your computer and use it in GitHub Desktop.
Save oguya/9013995 to your computer and use it in GitHub Desktop.
public class saveAsParcel implements Parcelable {
private String myStringValue;
public PassableObject() {}
public PassableObject(Parcel inParcel) {
myStringValue = inParcel.readString();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel outParcel, int flags) {
outParcel.writeString(myStringValue);
}
public String getMyStringValue() {
return myStringValue;
}
public void setMyStringValue(String myStringValue) {
this.myStringValue = myStringValue;
}
public static final Parcelable.Creator<PassableObject> CREATOR
= new Parcelable.Creator<PassableObject>() {
public PassableObject createFromParcel(Parcel in) {
return new PassableObject(in);
}
public PassableObject[] newArray(int size) {
return new PassableObject[size];
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment