I am passing ArrayList
to an Intent.
Both of the following ways seem to work fine with putting the ArrayList into the new
Instead of writing the Parcelable implementation yourself, try to use the Android Studio code completion (in Windows: Alt+Enter once you write "implements Parcelable" and again on the CustomObject class name). This prevent common bugs in the implementation.
Even so, beware: if you implement Parcelable and add/remove object variables in the CustomObject afterwards, the Parcelable implementation won't be valid any more.
In this case, you can manually add the missing details to the Parcelable methods, but I prefer to delete them and make Android Studio implement them again (be sure to delete ALL of the implemented Parcelable methods in the CustomObject, since Android Studio won't update Parcelable methods that already exist).
I suffered the same bug that you wrote about, and, after correctly re-implementing Parcelable on the CustomObject (I had changed it a few times since I last implemented Parcelable), everything worked fine.
Try retrieving the array with
getIntent().getExtras().getParcelableArrayList(yourArray);
try this my friend:
intent.putParcelableArrayListExtra("tag",yourObjectImplementsParceable);
xxx = (ArrayList<yourClassImplementsParceable>) intent.getParcelableArrayListExtra("tag");
hope this helps