【发布时间】:2015-09-15 12:08:41
【问题描述】:
我将 Arraylist 一个活动发送到另一个活动,但第二个活动显示空指针和空适配器。如何解决?谢谢。
第一个活动:
Bundle b = new Bundle();
b.putSerializable("array_list", listdata);
Intent movedata = new Intent(getApplicationContext(),Shopping.class);
movedata.putExtras(movedata);
startActivity(movedata);
第二个活动:
Intent intent = this.getIntent();
Bundle bundle = intent.getExtras();
ArrayList<XmlValueModel> listdata = (ArrayList<XmlValueModel>) bundle.getSerializable("array_list");
// ArrayAdapter<XmlValueModel> array = new ArrayAdapter<XmlValueModel>(getApplicationContext(), android.R.layout.simple_list_item_1, list);
listview = (ListView) findViewById(R.id.ListOne);
adapter = new CustomListAdapter(this, listdata);
listview.setAdapter(adapter);
}catch (Exception e){
Log.e("Error:", e.getMessage());
}
【问题讨论】:
标签: show