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

前端 未结 3 1974
慢半拍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:08

    Try this, put you arraylist using putStringArrayListExtra

    Intent i = new Intent(MainActivity.this,Nextactivity.class);
    i.putStringArrayListExtra("arraylist", arraylist);
    

    And get arraylist.

    Intent i = getIntent();
    list = i.getIntegerArrayListExtra("arraylist");
    

提交回复
热议问题