I am trying to retrieve data from a firestore collection according to the filters user is choosing. He also has the option for no filter. I am trying to use the filters in calling data from firestore using "where".I am using the Firestore query documents startsWith a string. But this works for only one filter as android does not lalow multiple of this and I need 4. How to do this? Here is my code for calling
CollectionReference collectionReference = db.collection("Tasks");
collectionReference
.whereGreaterthanorEqualTo("City",""+City)//I want to add multiple of these filters
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
String s = document.getId();
list.add(s);
}
mAdapter = new MyAdapter(list, TaskList.this);
recyclerView.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
}
}
});
Any help will be appreciated