我想发送一个 arraylist 到 parent activityprivate ArrayList<Receipt> receipts = new ArrayList<Receipt>();
Intent data = new Intent();
data. // what to do here?
setResult(RESULT_OK, data);
//************************************下面是简单的代码public class Receipt {
public String referenceNo;
public byte[] image;
public String comments;
public Date createdOn;
public Date updatedOn;如何在 intent 中添加,还有如何从 parent activity 里检索?onActivityResult(final int requestCode, int resultCode, final Intent data)
2 回答
扬帆大鱼
TA贡献1799条经验 获得超9个赞
public class Receipt implements Serializable{ public String referenceNo; public byte[] image; public String comments; public long createdOn; public long updatedOn; //... } //Put the list in the intent List<Receipt> list = ... Intent data = new Intent(); data.putExtra("tag", list); //Read the list from the intent: list = (List<Receipt>) data.getSerializableExtra("tag");
梦里花落0921
TA贡献1772条经验 获得超6个赞
Receipt extends Parcelable才能传递
public void putParcelableArrayList(String key, ArrayList<? extends Parcelable> value) {}
添加回答
举报
0/150
提交
取消