Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.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
Java Firebase如何使用orderbychild_Java_Android_Firebase_Firebase Realtime Database - Fatal编程技术网

Java Firebase如何使用orderbychild

Java Firebase如何使用orderbychild,java,android,firebase,firebase-realtime-database,Java,Android,Firebase,Firebase Realtime Database,medics/randomid/medicname=someValue 我要这个医生的名字和firebase一起得到listview dref = FirebaseDatabase.getInstance().getReference().child("users").child(kullaniciuid).child(medic).orderByChild("medicname"); dref.addChildEventListener(new ChildEventListener() {

medics/randomid/medicname=someValue

我要这个医生的名字和firebase一起得到listview

dref = FirebaseDatabase.getInstance().getReference().child("users").child(kullaniciuid).child(medic).orderByChild("medicname");

dref.addChildEventListener(new ChildEventListener() {
    @Override
    public void onChildAdded(DataSnapshot dataSnapshot, String s) {


        ss = dataSnapshot.getValue().toString();
        s = dataSnapshot.getKey();
        list.add(ss);

        barkodlist.add(s);

        count++;
        if(count >= dataSnapshot.getChildrenCount()){
            //stop progress bar here
            count = 0;
            adapter();
        }
    }

如果您的数据库看起来像:

medics:
    <RANDOM_UUID>:
        medicname: "Some value"

如果您正在使用
orderByChild

查询child,请忽略UUID。什么是问题?从标题或post.ss=dataSnapshot.child(“medicname”).getValue().toString()看不太清楚;我使用了这个代码,解决了这个问题
dref = FirebaseDatabase.getInstance().getReference().child("medics").orderByChild("medicname");
dref.addChildEventListener(new ChildEventListener() { ... });