【发布时间】:2020-02-02 21:10:51
【问题描述】:
我正在尝试发送 HashMap 以使用 startActivity(intent). 开始新活动
我遵循了这个链接的答案: How to send hashmap value to another activity using an intent
但我仍然得到错误
当然,我尝试发送字符串
intent.putExtra("test","some String");
startActivity(intent);
成功了
我的代码:
HashMap<String,Diner> dinersOrdersHasMap = new HashMap<String,Diner>();
FillHashMap(); // Fill the HashMap with data
Intent intent = new Intent(this, BillForm.class);
intent.putExtra("dinersOrderHashMap",dinersOrdersHasMap);
startActivity(intent);
例外:
"Could not execute method for android:onClick", e);
e.detailMessage = "Parcelable encountered IOException writing serializable
object (name = com.example.myfirstapp.Diner)
当我打电话时
startActivity(intent);
【问题讨论】: