Created
December 11, 2017 14:17
-
-
Save nhoxbypass/a3d3b839dd595a1e40efd9ce14aee1ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// access modifiers, accessors và constructors được bỏ qua cho ngắn gọn | |
class IceTeaVietDeveloper implements Parcelable { | |
String name; | |
int yearsOfExperience; | |
List skillSet; | |
float favoriteFloat; | |
IceTeaVietDeveloper(Parcel in) { | |
this.name = in.readString(); | |
this.yearsOfExperience = in.readInt(); | |
this.skillSet = new ArrayList(); | |
in.readTypedList(skillSet, Skill.CREATOR); | |
this.favoriteFloat = in.readFloat(); | |
} | |
void writeToParcel(Parcel dest, int flags) { | |
dest.writeString(name); | |
dest.writeInt(yearsOfExperience); | |
dest.writeTypedList(skillSet); | |
dest.writeFloat(favoriteFloat); | |
} | |
int describeContents() { | |
return 0; | |
} | |
static final Parcelable.Creator CREATOR | |
= new Parcelable.Creator() { | |
IceTeaVietDevelopercreateFromParcel(Parcel in) { | |
return new IceTeaVietDeveloper(in); | |
} | |
IceTeaVietDeveloper[] newArray(int size) { | |
return new IceTeaVietDeveloper[size]; | |
} | |
}; | |
static class Skill implements Parcelable { | |
String name; | |
boolean programmingRelated; | |
Skill(Parcel in) { | |
this.name = in.readString(); | |
this.programmingRelated = (in.readInt() == 1); | |
} | |
@Override | |
void writeToParcel(Parcel dest, int flags) { | |
dest.writeString(name); | |
dest.writeInt(programmingRelated ? 1 : 0); | |
} | |
static final Parcelable.Creator CREATOR | |
= new Parcelable.Creator() { | |
Skill createFromParcel(Parcel in) { | |
return new Skill(in); | |
} | |
Skill[] newArray(int size) { | |
return new Skill[size]; | |
} | |
}; | |
@Override | |
int describeContents() { | |
return 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment