I have a query like given below,
Query query = mDbRefusers_chat.child("chatId");
Now I want to check if that query exists. that is I want to check if a child with the name "chatId" exists. How to do that ?
I have a query like given below,
Query query = mDbRefusers_chat.child("chatId");
Now I want to check if that query exists. that is I want to check if a child with the name "chatId" exists. How to do that ?
Try this:
DatabaseReference ref=FirebaseDatabase.getInstance().getReference().child("chat_id");
ref.addValueEventListener(new ValueEventListener(){
@Override
public void onDataChange(DataSnapshot dataSnapshot){
if(dataSnapshot.exist() {
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
using dataSnapshot.exist()
it will check if the child chat_id
exists in the database.