Android 包裹数组列表不工作

Android 包裹数组列表不工作,android,parcelable,Android,Parcelable,我有一个自定义对象和一个数组列表,当我试图检索一个可包裹数组列表时,我得到一个空异常。自定义对象中的代码: public class Patient implements Parcelable { private String fullName; private String id; // this is the Key of the Table Patient private String address; private int age; private String telephone;

我有一个自定义对象和一个数组列表,当我试图检索一个可包裹数组列表时,我得到一个空异常。自定义对象中的代码:

public class Patient implements Parcelable {

private String fullName;
private String id; // this is the Key of the Table Patient
private String address;
private int age;
private String telephone;
private String Doctor;
private String  lastVisit;
private String healthStatus;

//constructor
public Patient(String fullName, String id, String address, int age, String telephone, String doctor, String lastVisit, String healthStatus) {
    this.fullName = fullName;
    this.id = id;
    this.address = address;
    this.age = age;
    this.telephone = telephone;
    Doctor = doctor;
    this.lastVisit = lastVisit;
    this.healthStatus = healthStatus;
}

//Key
public String getId() {
    return id;
}

public String getAddress() {
    return address;
}

public int getAge() {
    return age;
}

public String getTelephone() {
    return telephone;
}

public String getDoctor() {
    return Doctor;
}

public String getFullName() {

    return fullName;
}

public String getLastVisit() {
    return lastVisit;
}

public String getHealthStatus() {
    return healthStatus;
}

@Override
public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(age);
    dest.writeString(fullName);
    dest.writeString(address);
    dest.writeString(id);
    dest.writeString(telephone);
    dest.writeString(Doctor);
    dest.writeString(String.valueOf(lastVisit));
    dest.writeString(healthStatus);
}

public static final Parcelable.Creator<Patient> CREATOR = new Parcelable.Creator<Patient>() {
    public Patient createFromParcel(Parcel in) {
        return new Patient(in);
    }

    public Patient[] newArray(int size) {
        return new Patient  [size];
    }

};

private Patient(Parcel in) {
    age = in.readInt();
    fullName = in.readString();
    address = in.readString();
    id = in.readString();
    telephone = in.readString();
    Doctor = in.readString();
    fullName = in.readString();
    healthStatus = in.readString();
    lastVisit =  in.readString();
}

}
出于某种原因,下一个活动的列表为空,我在尝试使用它时遇到异常

我遵循文档,但我无法找出哪里是错误的部分。此外,第一个活动中的列表中充满了数据


谢谢你的帮助

您正在将列表放入意图中,但在第二个活动中尝试从
savedInstanceState
检索列表。您需要从意图中检索列表

patientList = getIntent().getParcelableArrayList("patientList"); // May require a cast if you partient list is a specific type

您正在将列表放入意图中,但在第二个活动中尝试从
savedInstanceState
检索它。您需要从意图中检索列表

patientList = getIntent().getParcelableArrayList("patientList"); // May require a cast if you partient list is a specific type

您正在将列表放入意图中,但在第二个活动中尝试从
savedInstanceState
检索它。您需要从意图中检索列表

patientList = getIntent().getParcelableArrayList("patientList"); // May require a cast if you partient list is a specific type

您正在将列表放入意图中,但在第二个活动中尝试从
savedInstanceState
检索它。您需要从意图中检索列表

patientList = getIntent().getParcelableArrayList("patientList"); // May require a cast if you partient list is a specific type

好的,谢谢,现在我知道了:在偏移量360处解组未知类型代码7864421。解组时,您正在读取
fullName
两次。检查这一行
fullName=in.readString()有两次。是的,我知道我以前见过,谢谢你的帮助!好的,谢谢,现在我知道了:在偏移量360处解组未知类型代码7864421。解组时,您正在读取
fullName
两次。检查这一行
fullName=in.readString()有两次。是的,我知道我以前见过,谢谢你的帮助!好的,谢谢,现在我知道了:在偏移量360处解组未知类型代码7864421。解组时,您正在读取
fullName
两次。检查这一行
fullName=in.readString()有两次。是的,我知道我以前见过,谢谢你的帮助!好的,谢谢,现在我知道了:在偏移量360处解组未知类型代码7864421。解组时,您正在读取
fullName
两次。检查这一行
fullName=in.readString()有两次。是的,我知道我以前见过,谢谢你的帮助!