Below code read each document iteratively
db.collection("anyCollection")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
QuerySnapshot querySnapshot = task.getResult();
List<DocumentSnapshot> documentSnapshots = querySnapshot.getDocuments();// add check for each type of document...
for(DocumentSnapshot snapshot: documentSnapshots){
HashMap<String,Object> map = new HashMap<>();
map = (HashMap<String, Object>) snapshot.getData();
///https://stackoverflow.com/a/1066607/3496570
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
// ...
}
}
} else {
Log.d(TAG, "Error getting documents: ", task.getException());
}
}
});