Skip to content

Instantly share code, notes, and snippets.

@wirasetiawan29
Created January 19, 2016 14:48
Show Gist options
  • Save wirasetiawan29/fb257f3d8b780967f13c to your computer and use it in GitHub Desktop.
Save wirasetiawan29/fb257f3d8b780967f13c to your computer and use it in GitHub Desktop.
package com.wirasetiawan.expandlistview;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by wira on 1/19/16.
*/
public class Item implements Parcelable{
public String title;
public String desciption;
public boolean isExpanded;
public Item(){}
public Item(Parcel in){
title = in.readString();
desciption = in.readString();
isExpanded = in.readInt() == 1;
}
@Override
public int describeContents(){
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags){
dest.writeString(title);
dest.writeString(desciption);
dest.writeInt(isExpanded ? 1 : 0);
}
public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>(){
@Override
public Item createFromParcel(Parcel source){
return new Item(source);
}
@Override
public Item[] newArray(int size) {
return new Item[size];
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment