How to put a List in intent

后端 未结 5 1903
无人共我
无人共我 2020-11-29 11:28

I have a List in one of my activities and need to pass it to the next activity.

private List selectedData;  

I tried putting

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 11:57

    You have to instantiate the List to a concrete type first. List itself is an interface.

    If you implement the Parcelable interface in your object then you can use the putParcelableArrayListExtra() method to add it to the Intent.

提交回复
热议问题