How To Get Firestore Data From A Loop And Send To Recyclerview Adaptor
I am loading data from firestore into recycler view android. It is a kind of e-commerce cart system in which the items' Uids are stored. I have my ArrayList of uids(I've already re
Solution 1:
You can do like this
ArrayList<DocumentSnapshot> documentSnapshots = new ArrayList<>();
//getting the document snapshot out of the uids
int count = uids.size();
for (int i = 0 ; i < uids.size() ; i++){
db.collection("items").document(uids.get(i)).get()
.addOnCompleteListener(task1 -> {
documentSnapshots.add(task1.getResult());
if(documentSnapshots.size() == count){
adaptorCart = new AdaptorCart(Cart.this , modelCart , db , documentSnapshots);
}
});
}
Post a Comment for "How To Get Firestore Data From A Loop And Send To Recyclerview Adaptor"