Can't pass an ArrayList to an activity

前端 未结 2 1147
渐次进展
渐次进展 2021-01-19 03:03

This is the code

ArrayList list = new ArrayList();
list.add(new MyObject());
Intent intent = new Intent(this, ReceiverActivit         


        
相关标签:
2条回答
  • 2021-01-19 03:38

    USe i.putParcelableArrayListExtra(name, value) where i is your intent. Dont use putExtra() for a parcelable ArrayList.

    0 讨论(0)
  • 2021-01-19 03:45

    Try:

    ArrayList<MyObject> myList = extras.<MyObject>getParcelableArrayList("list"));
    
    0 讨论(0)
提交回复
热议问题