Intent传递对象

来源:互联网 发布:网狐6603捕鱼源码 编辑:程序博客网 时间:2024/04/29 20:52
Intent intent = new Intent(ShangpinManageActivity.this, EditCommodityDetailActivity.class);                    Bundle bundle = new Bundle();                    bundle.putSerializable(SIA_KEY, goodsInfo);                    intent.putExtras(bundle);                    startActivity(intent);


获取:

GoodsInfo goodsInfo = (GoodsInfo) getIntent().getSerializableExtra(ShangpinManageActivity.SIA_KEY);
集合也是可以传递的:
Intent intent = new Intent(this, AddGroupDetailActivity.class);                    Bundle bundle = new Bundle();                    bundle.putSerializable("listDatas", (Serializable) popListDatas);                    intent.putExtras(bundle);                    startActivityForResult(intent, 102);

获取:

groupDatas = new ArrayList<GoodsInfo>();        groupDatas = (List<GoodsInfo>) getIntent().getSerializableExtra("listDatas");  



0 0