title: How to check if a value exists in firebase
body: <p>before reading I'm a newbie trying to learn android development so don't go hard on me, please.</p>
  
  <p>I have this Realtime database firebase :</p>
  
  <p><a href="https://i.stack.imgur.com/UbCDM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UbCDM.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to check if the entered email exists , i've tried a method but it did not work out for me.</p>
  
  <p>I tried this method :</p>
  
  <pre><code>private boolean checkIfExistes() {
  
  
      reference.child("Users").orderByChild("email").equalTo(Email.getText().toString()).addListenerForSingleValueEvent(new ValueEventListener() {
          @Override
          public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
              if (dataSnapshot.exists())
                  CheckExists =true;
              else
                  CheckExists =false;
          }
  
          @Override
          public void onCancelled(@NonNull DatabaseError databaseError) {
  
          }
      });
  
      if (CheckExists)
          return  true;
      else
          return false;
  
  }
  </code></pre>
  
  <p>it always returns false though even if the email exists. Help please.</p>