我正在尝试发送HashMap以开始使用startActivity(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);
您的 Diner 类是可序列化的还是可包裹的?
你能在这里发布你的晚餐课吗?