All You have to do is do a nested query .! first find key of parent then get pass that key to next query and then find its children.!
List<user> userList=new ArrayList();
mdatabaseRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot child: dataSnapshot.getChildren()){
String key = child.getKey();
fun(key);
}
private void fun(String key){
mdatabaseRef.child(key).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {for (DataSnapshot child: dataSnapshot.getChildren()){
User user= postsnapshot.getValue(User.class);
userList.add(user);
}
}
1
solved how to retrieve all the keys in firebase android