How to implement parcelable for List

后端 未结 1 811
旧巷少年郎
旧巷少年郎 2021-01-12 03:30

I\'m trying to pass a List in my parcelable doing:

public class MetaDados implements Parcelable {

private List sizeImages;

public MetaDados(Lis         


        
相关标签:
1条回答
  • 2021-01-12 04:37

    Try this instead:

    sizeImages = new ArrayList<Long>(); // or any other type of List
    in.readList(sizeImages, null);
    

    The Android documentation for Parcel.readList says:

    Read into an existing List object from the parcel

    and thus, you need to first create the List.

    0 讨论(0)
提交回复
热议问题