Is there any way to get another user's uid from realtime database? I want to get 2 name objects from the database with different uids at the same time.
Json file:
"Users" : {
"PnZdR1Ily5R5R58FYFVEuWN0Q855" : {
"-Kwwceeevvvvvttvv" : {
"name" : "abc"
},
"-Kccrr325gdfgdfFg" : {
"name" : "abc"
}
},
"MeTsW4SsW6e8hGrsFfVUuNNaQ3cj" : {
"-Kfvr345345354555" : {
"name" : "zxc"
},
"-Kbfhf56464646646" : {
"name" : "zxc"
}
}
}
This is my code:
ValueEventListener postListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
User details = dataSnapshot.getValue(User.class);
mName = details.name;
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.w(TAG, "getUser:onCancelled", databaseError.toException());
}
};
mDatabase.child("Users").child($uid).addValueEventListener(postListener);
This is the part I'm stuck on, how do I get both uids at the same time?