Reputation: 51
So, this is how my json database looks
I need to grab information from this
The problem is that all the children of this element have the null value.(I am only interested in their key which is represented by push ids)
My program should return a list
of the keys.(or part of them). Any ideas on how do I do it in android studio ?
Here is my code that gets executed to retrieve..still not working..any ideas on what am I doing wrong..?
Upvotes: 1
Views: 86
Reputation: 1022
Use DataSnapshot.getKey()
to get the key. You can loop through all the children by using:
for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) {
String key = childSnapshot.getKey();
}
Upvotes: 2