Passing ArrayList Between multiple Activities

前端 未结 6 874
暖寄归人
暖寄归人 2020-12-10 06:11

I am trying to pass an ArrayList of Objects between multiple activities in my application. Is it possible to do this using an Intent using the setData() method?

6条回答
  •  情深已故
    2020-12-10 06:51

    First you need to extend parcelable class in your Object class. Then you can pass it through intent via intent.putParcelableArrayListExtra("PASSING_DATA", data);

    here data is arraylist of custom objects.

    see Parcelable and Parcelable Tutorial for better undertanding

提交回复
热议问题