This is my Firebase database structure
STUDENT
ur14cs002
id:ur14cs002
pass:abc
ur14cs001
id:ur13cs001
pass:def
I have to check with my user's id like when user enter in edit text that needs to be check if that particular user exists in the database or not. Below code this is what i did bt this code is not working at all.
EditText id = (EditText) findViewById(R.id.userEmail);
EditText password = (EditText) findViewById(R.id.userPassword);
database = FirebaseDatabase.getInstance();
String child = id.getText().toString();
String pass = password.getText().toString();
myRef = database.getReference("STUDENT").child(child);
myRef.orderByChild("id").equalTo(child).addValueEventListener(new ValueEventListener(){
@Override
public void onDataChange(DataSnapshot dataSnapshot){
if(dataSnapshot.exists() ){
Toast.makeText(getApplicationContext(),"PRESENT",Toast.LENGTH_LONG).show();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});}}