[英]How can i retrieve all child nodes of unique key in Firebase
I am creating an application which uses Firebase and Geofire. 我正在创建一个使用Firebase和Geofire的应用程序。 I am able to store values in FireBase.
我能够在FireBase中存储值。
In Geoquery I am getting the keys which are in that particular area. 在Geoquery中,我得到了该特定区域中的键。 I want to retrieve all the child nodes of that particular key only.
我只想检索该特定键的所有子节点。 how do I do that?
我怎么做?
i want to retrieve the child values of the key -KpzaWx6FfdT27FlEoaZ 我想检索键-KpzaWx6FfdT27FlEoaZ的子值
how do I do that? 我怎么做?
please give the full code for getting all the values of -KpzaWx6FfdT27FlEoaZ <---- this key only I should get 请给出完整的代码以获取-KpzaWx6FfdT27FlEoaZ <----的所有值,只有我应该得到的
Assuming that user_Location
is the direct child of your Firebase root, please use this code: 假设
user_Location
是Firebase根目录的直接子级,请使用以下代码:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference userLocationRef = rootRef.child("user_Location").child("-KpzaWx6FfdT27FlEoaZ").child("l");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Double lat = ds.child("0").getValue(Double.class);
Double long = ds.child("0").getValue(Double.class);
Log.d("TAG", lat + " / " + long);
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
userLocationRef.addListenerForSingleValueEvent(eventListener);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.