【发布时间】:2014-08-26 07:41:39
【问题描述】:
想要将 ArrayList 发送到另一个活动, 在运行时使用面向意图的错误
"parcel: unable to marshal value error".
我的代码:
Intent i = new Intent(getBaseContext(),SecondActitivty.class);
Bundle extra = new Bundle();
extra.putSerializable("objects", hotellista);
try {
/*Bundle bundle = new Bundle();
bundle.putSerializable("searchresul8t", hotellista);*/
i.putExtra("searchrtre", extra);
//i.putExtras(bundle);
//i.putExtra("searchresult", hotellista);
startActivity(i);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
【问题讨论】:
-
您的
ArrayList包含哪些对象? ? -
你的activity是否实现了Serializable
-
我在 bean 类中使用实现可序列化。但现在我也遇到类似 java.lang.RuntimeException: Parcelable 遇到 IOException 写入可序列化对象的错误
-
所以你的bean类应该实现Parceable而不是serializable。请先发布你的堆栈跟踪,以便我们查明问题
标签: android android-intent arraylist