我想在addOnSuccessListener内部传递查询
我曾尝试解决此问题,但未获得预期结果
db.collection("Buildings").get()
.addOnSuccessListener(new
OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()){
progressDialog.setTitle("Opening Buildings. Please Wait..");
progressDialog.show();
List<DocumentSnapshot> list = queryDocumentSnapshots.getDocuments();
for (DocumentSnapshot d:list){
Building b = d.toObject(Building.class);
b.setId(d.getId());
buildingList.add(b);
}
progressDialog.hide();
adapter.notifyDataSetChanged();
}
}
});
上面的代码输出的是所有建筑物的清单 我只想显示其中一些