I have a Firebase database with a JSON structure like this:
JSON
root:{
"users":{
*push1*:{
"name":"foo1",
"email":"bar1"
},
*push2*:{
"name":"foo2",
"email":"bar2"
}
}
}
In order to populate a RecyclerView, I am using the FirebaseRecyclerViewAdapter class at FirebaseUI. The problem is that I can access both "name" and "email", but in addition I need to know the *push* string (something like -KHjGvJ7o-UBxOVGpojI), which I don't manage to get.
Is there any way to get the key of the reference, instead of just the value?
What I'm trying to do is adding a new value to the JSON, leaving it like:
"users":{
*push*:{
"name":"foo",
"email":"bar",
"phone":"whatever"
}
}
Just in case it is easier to get the reference rather than the key to generate it.
Thanks!