august alsina august alsina - 5 months ago 70
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?


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();