How to pass a parcelable object that contains a list of objects?

后端 未结 9 993
眼角桃花
眼角桃花 2020-12-04 08:12

I have created a Parcelable object below, my object contains a List of Products. In my constructor how do I handle re-creating my Parcelable<

9条回答
  •  粉色の甜心
    2020-12-04 08:43

    Assuming the Product is implementing Parcelable, you can use this for writing:

    dest.writeValue(products);
    

    and this for reading:

    products = (List) in.readValue(Product.class.getClassLoader());
    

提交回复
热议问题