I want to retrieve all the keys under single key, tried many things, but nothing work till now.
This is my data structure
<
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 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);
}
}