想要将ArrayList发送到另一个活动, 在运行时使用面向错误的
"parcel: unable to marshal value error".
mycode的:
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();
}
答案 0 :(得分:0)
您的班级必须实施Parcelable,以便您可以将其从Activity
转移到另一个
答案 1 :(得分:0)
试试这个
Intent i = new Intent(getBaseContext(),SecondActitivty.class);
try {
i.putParcelableArrayListExtra("YourArrayList", yourarraylist);
// or you can try like
i.putStringArrayListExtra("YourArrayList", yourarraylist);
startActivity(i);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}