august alsina august alsina - 7 months ago 83
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();