There is the following structure:
@SerializedName("data") @Expose private List<Data> data = new ArrayList<Data>(); How to write parcel for her?
@Override public void writeToParcel(Parcel parcel, int i) { //Что тут написать? } data = new ArrayList();
Ho..."> At the same time, the Data class should also be Parcelable. To read the list in the creator, you will need to write: Method descriptions: https://developer.android.com/reference/android/os/Parcel.html#writeTypedList(java.util.List%3CT%3E) I recommend the Android Parcelable Code Generator plugin for Android Studio. PS Instead of sending a structure of the type If Source: https://ru.stackoverflow.com/questions/587044/2 answers
parcel.writeTypedList(data);data = parcel.createTypedArrayList(Data.CREATOR);{data: [...]} with the back-end, you can send [...] , and in Android you can take it as ArrayList<Data> .Data implements Parcelable , then you can use the methods:
- parcel.writeTypedList(data) for writing
- parcel.createTypedArrayList(Data.CREATOR) for reading
The documentation provides a complete list of possible methods.
All Articles