I am looking for a way to get data from the firebase real-time database in a format like an array[] or a String.
My database looks like this: Link to image of database
Or:
Database
|
-->Users
|
-->UID1
-->UID2
This is at the root of the database I want to get a list of all of the UIDs in the "Users" child. This is the code I have so far and am a bit stuck on:
DatabaseReference databaseReference = firebaseDatabase.getReference("Users");
databaseReference.addValueEventListener(
new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String UIDs = dataSnapshot.getValue(String.class);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
I am a bit of a rookie as it comes to java, android studio, and firebase. I am trying to get the data in a format I know how to use like a String or an Array[] of Strings. I looked around if other people had maybe asked the same question, but I could get the answers to those questions to work/didn't understand them. Thanks in advance for your time!