I'm trying to make my class parcelable, but it has a list of enums inside.
I've already seen how to do this with single enums here...
How could I do this?
Thanks! ;)
さて、前に引用したリンクの情報を使用してこれを解決しました。
それが私がしたことでした:
public enum Improvement {ENUM1, ENUM2, etc}
public void writeToParcel(Parcel dest, int flags) {
...
List<String> improvementStrings = new ArrayList<String>();
for (Improvement improvement : improvements) {
improvementStrings.add(improvement.name());
}
dest.writeList(improvementStrings);
}
public void readFromParcel(Parcel in) {
...
List<String> improvementStrings = new ArrayList<String>();
in.readList(improvementStrings, null);
for (String improvementString : improvementStrings) {
improvements.add(Improvement.valueOf(improvementString));
}
}