august alsina august alsina - 1 year ago 119
Android Question

Get child name from Firebase?

If I have something like:

child name: "value"

How can I get the childname? I know its possible to get the value, but what about the other?

Answer Source

Yes! The child name in this situation is the "KEY" of that value. So use the reference object and simple call getKey() on it.

String name = ref.getKey();