public class ParcelObject implements Parcelable{ public String paramOne; public String paramToo; public ParcelObject(String paramOne, String paramToo ) { this.paramOne = paramOne; this.paramToo = paramToo; } private ParcelObject(Parcel parcel) { paramOne = parcel.readString(); paramToo = parcel.readString(); } public static final Creator<ParcelObject> CREATOR = new Creator<ParcelObject>() { @Override public ParcelObject createFromParcel(Parcel in) { return new ParcelObject(in); } @Override public ParcelObject[] newArray(int size) { return new ParcelObject[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(paramOne); dest.writeString(paramToo); } } 

And when you try to add Parcelable in the Parcelable , nothing Parcelable in the ArrayList . Not added.

 ArrayList<ParcelObject > arraylist = new ArrayList<>(); ParcelObject c = new ParcelObject ("Name","Title"); arraylist .add(c); 

ArrayList remains empty.

  • And how do you find out that it is empty? - Yuriy SPb
  • It contains one value. Passed the debugger. This value is exactly the added Parcelable, which contains two lines. The question now is how to get them upon receipt. ArrayList <ParcelObject> myList; myList = getArguments (). getParcelableArrayList ("MT"); So I get ArrayList with Parcelable. And how to get to its values? - Kamenev_D
  • Uh-uh ... myList.get (0)? - JuriySPb
  • Are you seriously? You can get array from arguments, but the problem for you is getting values ​​from array? - Nikotin N
  • That could not think what could be done like this. ParcelObject obg = myList.get (0); Thank you, Yuri. I got it, but did not know what to do next with him. Or rather could not even assume that such a construction will pass. - Kamenev_D

0