Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database Firebase数据库子级中的查询_Database_Firebase - Fatal编程技术网

Database Firebase数据库子级中的查询

Database Firebase数据库子级中的查询,database,firebase,Database,Firebase,我不熟悉安卓系统。有人能帮我查询firebase中下面划线的行吗?查询结果应为带下划线的字符串 该字符串是在驱动程序注册时在firebase中自动生成的。所以硬编码字符串不是我的目标 参考用户/驱动程序并遍历子项,您将获得您的密钥: DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child("Driver"); ValueEventListener lis

我不熟悉安卓系统。有人能帮我查询firebase中下面划线的行吗?查询结果应为带下划线的字符串


该字符串是在驱动程序注册时在firebase中自动生成的。所以硬编码字符串不是我的目标

参考
用户/驱动程序
并遍历子项,您将获得您的密钥:

DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child("Driver");


ValueEventListener listener = new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {

      //loop through the children
       for(DataSnapshot ds: dataSnapshot.getChildren()){

         //get the key or keys depending on how many keys

          String underLinedKey = ds.getKey();

       }

    }

    @Override
    public void onCancelled(DatabaseError databaseError) {
        //log error
        Log.w(TAG, "loadPost:onCancelled", databaseError.toException());

    }
};
mDatabase.addValueEventListener(listener);

你能分享一些你已经尝试获取键值的代码吗?