单击单元格时,对象将添加到数组中。这个数组需要传递到另一个活动中。出于测试目的,我传递了只有一个对象 DoctorObject 的数组。然后在下一个活动中,我使用 .getName() 以字符串形式获取名称并将其显示在吐司中。然而吐司是空的。
这是代码的一些片段
目的:
public class DoctorObject implements Parcelable {
private List<Object> mChildrenList;
public DoctorObject(String name) {
Docname = name;
}
public DoctorObject (Parcel in){
this.DocPic = in.readInt();
this.Docname= in.readString();
this.Docspecialty = in.readString();
this.DocLocation = in.readString();
}
String Docname = "";
public String getDocname() {
return Docname;
}
public void setDocname(String docname) {
Docname = docname;
}
public int getDocPic() {
return DocPic;
}
public void setDocPic(int docPic) {
DocPic = docPic;
}
public String getDocspecialty() { …Run Code Online (Sandbox Code Playgroud)