private void getStores(ArrayList<String> checkedItems) {
newSeller = new ArrayList<>();
sellers = new ArrayList<>();
a = 0;
for (int i =0; i<checkedItems.size(); i++){
String checkedItem = checkedItems.get(i);
int finalA = i;
getStore(checkedItem);
}
}
private void getStore(String checkedItem) {
db.collection("Seller")
.whereEqualTo("typ", checkedItem)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
SellerObject so = document.toObject(SellerObject.class);
so.setId(document.getId());
sellers.add(so);
Log.i(TAG, "onComplete: toa"+sellers.size());
}
} else {
Log.d(TAG, "Error getting documents: ", task.getException());
}
}
});
}
答案 0 :(得分:0)
您要在第一个函数中声明“ sellers”数组,然后尝试从第二个函数中添加该数组。将卖家移出该功能,以便可以使用它。