从Firebase获取孩子名字? [英] Get child name from Firebase?

查看:164
本文介绍了从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?

推荐答案

这种情况下的子名称是KEY 的价值。所以使用引用对象,并调用getKey()。

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

String name = ref.getKey();

这篇关于从Firebase获取孩子名字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆