答案 0 :(得分:1)
假设屏幕截图是coorect且结构为Firebase-root -> messages -> status
,请使用以下代码:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference statusRef = rootRef.child("status");
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String status = ds.getValue(String.class);
Log.d("TAG", status);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
statusRef.addListenerForSingleValueEvent(eventListener);