I am new to android and just learned to create a users profile like facebook or instagram, currently I have registered four users with email/password and in database am storing
Firebase is NoSql. You need to retrieve all users from myRef.child("users") and apply iterator to get names of all users.
To display those names, please use this code:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference usersdRef = rootRef.child("users");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String name = ds.child("name").getValue(String.class);
Log.d("TAG", name);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
usersdRef.addListenerForSingleValueEvent(eventListener);
And the output will be in this case all your user names.