问题
medics/randomid/medicname = someValue
I want this medic name get listview with firebase
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();
}
}
回答1:
If your database looks like:
medics:
<RANDOM_UUID>:
medicname: "Some value"
Then you should query using
dref = FirebaseDatabase.getInstance().getReference().child("medics").orderByChild("medicname");
dref.addChildEventListener(new ChildEventListener() { ... });
Ignore the UUID if you're querying childs using orderByChild.
来源:https://stackoverflow.com/questions/47803870/firebase-how-to-use-orderbychild