我尝试连接firebase并获取驱动程序部分下的所有数据 have node and under this node have 3 items and want to get all data under this item
答案 0 :(得分:0)
请使用此代码:
DatabaseReference driverRef = FirebaseDatabase.getInstance().getReference().child("Hock").child("Driver");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String point = ds.getKey();
Log.d("TAG", point);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
driverRef.addListenerForSingleValueEvent(eventListener);
您的输出将是:
point1
point2
point3
希望它有所帮助。