Passing ArrayList of an object from one activity to another in android

前端 未结 3 1928
慢半拍i
慢半拍i 2021-01-29 00:23

So the case is i want to send data from one activity to another with the help of ArrayList of objects. Below is the class code which i want to use as object. So please tell me t

3条回答
  •  礼貌的吻别
    2021-01-29 01:04

    1st Activity

            Arraylist values;
    
            Intent it=new Intent(MainActivity.this,Next.class);
            it.putExtra("value", values);
            startActivity(it);
    

    2nd Activity

      Arraylist list;
    
    list=(ArrayList) getIntent().getSerializableExtra("value");
    

提交回复
热议问题