title: How to retrieve data using email from firebase realtime databse?
body: <p>I have a database from firebase. I want to retrieve some data using a user's email. suppose user put his/her email if the email exists in the firebase database then it shows his/her username and password. I am not using firebase authentication, I am using firebase realtime database.
  here is my database structure:
  <a href="https://i.stack.imgur.com/Q4nWT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q4nWT.png" alt="database structure"></a></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_forgate_password);
  
      emailf = findViewById(R.id.emailf);
      userf = findViewById(R.id.usernamef);
      passwordf = findViewById(R.id.passwordf);
  
      ok = findViewById(R.id.okbtn);
  
      database = FirebaseDatabase.getInstance();
      users = database.getReference("Users").child("emailAddress");
  
      ok.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              signInMethod(emailf.getText().toString());
          }
      });
  }
  
  private void signInMethod(final String email) {
  
      users.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              // This method is called once with the initial value and again
              // whenever data at this location is updated.
              if (dataSnapshot.child("emailAddress").exists()){
                  if (dataSnapshot.child(user.getUserName()).exists()){
                      Toast.makeText(ForgatePassword.this,"User already exists",Toast.LENGTH_LONG).show();
                  }
              }
          }
  
          @Override
          public void onCancelled(DatabaseError error) {
              // Failed to read value
              Log.w("Tag", "Email not exists", error.toException());
          }
      });
  }
  </code></pre>
  
  <p>here is my model class:
  public class SignInUpModel {</p>
  
  <pre><code>private String fullName;
  private String userName;
  private String schoolName;
  private String className;
  private String division;
  private String phnNumber;
  private String emailAddress;
  private String reference;
  private String password;
  
  public SignInUpModel() {
  
  }
  
  public SignInUpModel(String fullName, String userName, String schoolName, String className, String division, String phnNumber, String emailAddress, String reference, String password) {
      this.fullName = fullName;
      this.userName = userName;
      this.schoolName = schoolName;
      this.className = className;
      this.division = division;
      this.phnNumber = phnNumber;
      this.emailAddress = emailAddress;
      this.reference = reference;
      this.password = password;
  }
  
  public String getFullName() {
      return fullName;
  }
  
  public void setFullName(String fullName) {
      this.fullName = fullName;
  }
  
  public String getUserName() {
      return userName;
  }
  
  public void setUserName(String userName) {
      this.userName = userName;
  }
  
  public String getSchoolName() {
      return schoolName;
  }
  
  public void setSchoolName(String schoolName) {
      this.schoolName = schoolName;
  }
  
  public String getClassName() {
      return className;
  }
  
  public void setClassName(String className) {
      this.className = className;
  }
  
  public String getDivision() {
      return division;
  }
  
  public void setDivision(String division) {
      this.division = division;
  }
  
  public String getPhnNumber() {
      return phnNumber;
  }
  
  public void setPhnNumber(String phnNumber) {
      this.phnNumber = phnNumber;
  }
  
  public String getEmailAddress() {
      return emailAddress;
  }
  
  public void setEmailAddress(String emailAddress) {
      this.emailAddress = emailAddress;
  }
  
  public String getReference() {
      return reference;
  }
  
  public void setReference(String reference) {
      this.reference = reference;
  }
  
  public String getPassword() {
      return password;
  }
  
  public void setPassword(String password) {
      this.password = password;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>How can I do this?</p>