📅  最后修改于: 2022-03-11 15:00:06.099000             🧑  作者: Mango
databaseReference = FirebaseDatabase.getInstance().getReference().child("Attendance").child(istrustnumberavailable);
databaseReference.limitToFirst(5);
Query query = databaseReference.orderByChild("name").equalTo("prof");
ChildEventListener removedListener = query.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
if (dataSnapshot.exists()){
long count= dataSnapshot.getChildrenCount();
}
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
if (dataSnapshot.exists()){
long count= dataSnapshot.getChildrenCount();
}
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()){
long count= dataSnapshot.getChildrenCount();
}
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});