从包裹中读取的顺序与您输入的顺序不同。
在
writeToParcel()你第一次把字符串,但在
HeatFriendDetail(Parcelin),你先读整数。这不是正确的方法,因为顺序或读/写很重要。
以下是在与包裹之间进行数据读写的正确顺序的代码(另请参见此链接):
public class FriendDetail implements Parcelable { private String full_name; private int privacy; public HeatFriendDetail(Parcel in) { this.full_name = in.readString(); this.privacy = in.readInt(); } public HeatFriendDetail() { } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.full_name); dest.writeInt(this.privacy); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public HeatFriendDetail createFromParcel(Parcel in) { return new HeatFriendDetail(in); } public HeatFriendDetail[] newArray(int size) { return new HeatFriendDetail[size]; } }; // GETTER SETTER//}


