Firebase ile belirtilen düğümün altındaki veri alma örneğidir. Alınan bu verileri key-value çifti halinde elde ediyoruz.
refdb.child("users").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot uniqueKeySnapshot : dataSnapshot.getChildren()){
//Loop 1 to go through all the child nodes of users
for(DataSnapshot booksSnapshot : uniqueKey.child("Books").getChildren()){
//loop 2 to go through all the child nodes of books node
String bookskey = booksSnapshot.getKey();
String booksValue = booksSnapshot.getValue();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
}
Source : https://stackoverflow.com/questions/47097787/firebase-android-how-get-children-keys-and-values