The accepted answer solved the problem for me. I just want to share my implementation for couple of methods to handle the Parcel on the fly! and still have the array as ArrayList<DocumentReference>
.
private ArrayList<String> docRefToString(ArrayList<DocumentReference> products) {
ArrayList<String> newProducts = new ArrayList<String>();
for (DocumentReference product : products) {
newProducts.add(product.getPath());
}
return newProducts;
}
private ArrayList<DocumentReference> docStringToDoc(ArrayList<String> products) {
ArrayList<DocumentReference> newProducts = new ArrayList<DocumentReference>();
for (String product : products) {
newProducts.add(FirebaseFirestore.getInstance().document(product));
}
return newProducts;
}
And in the Parcel
implementation ..
private Request(Parcel in) {
...
ArrayList<String> strProducts = in.createStringArrayList();
this.products = docStringToDoc(strProducts);
...
}
@Override
public void writeToParcel(Parcel dest, int flags) {
...
dest.writeStringList(docRefToString(this.products));
...
}