1. 程式人生 > >intent傳遞序列化的集合物件

intent傳遞序列化的集合物件

傳送:

 public static void startAct(Context context, int type, List<OrderShowBean.GoodsBean> goods) {
        Intent intent = new Intent(context,EditHandleActivity.class);
        intent.putExtra("type", type);
        //傳遞從操作訂單介面傳遞過來的資料
        Bundle bundle = new Bundle();
        bundle.
putSerializable("list",(Serializable)goods); intent.putExtras(bundle); context.startActivity(intent); }

接收:

    Intent intent = getIntent();
    mGoodsList = (List<OrderShowBean.GoodsBean>) intent.getSerializableExtra("list");