I have a Firebase database as shown in the pic. I am trying to retrieve data based on some condition but it shows no results.
DbRef2 =FirebaseDatabase.getInstance().getReference().child("Notification");
DbRef2.child("45961").orderByChild("FromId").startAt("22222").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()){
Toast.makeText(getApplicationContext(),"hello",Toast.LENGTH_SHORT).show();
Notification notf = dataSnapshot.getValue(Notification.class);
Toast.makeText(getApplicationContext(),"hai"+notf.getFromId(),Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
There is nothing shows in the toast. I also tried equalTo instead of startAt. but no results.