title: register and login process in android through firestore
body: <p>I am new in android, I am trying to develop a simple system in android and using the cloud firestore beta as the database. I have already done the registration part which is writing the data(email &amp; password) in the database. but I do not know the process for the login as i want the system to read the data from the database and match with the emails and passwords from the database. Can anyone help me? Thanks in advance.
  The registration activity is given below:</p>
  
  <pre><code>public class RegisterActivity extends AppCompatActivity {
  
      private Button btnRegister;
  
      private EditText edtxtEmail;
      private EditText edtxtTpnumber;
      private EditText edtxtDepartment;
      private EditText edtxtPassword;
      private EditText edtxtConfirmpassword;
  
      private FirebaseFirestore rFireStore;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_register);
  
          rFireStore = FirebaseFirestore.getInstance();
  
          btnRegister = (Button) findViewById(R.id.btnregister);
          edtxtEmail = (EditText) findViewById(R.id.edtxtemail);
          edtxtTpnumber = (EditText) findViewById(R.id.edtxttpnumber);
          edtxtDepartment = (EditText) findViewById(R.id.edtxtdepartment);
          edtxtPassword = (EditText) findViewById(R.id.edtxtpassword);
          edtxtConfirmpassword = (EditText) findViewById(R.id.edtxtconfirmPassword);
  
          btnRegister.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String Email = edtxtEmail.getText().toString();
                  String TPnumber = edtxtTpnumber.getText().toString();
                  String Department = edtxtDepartment.getText().toString();
                  String Password = edtxtPassword.getText().toString();
                  String ConfirmPassword = edtxtConfirmpassword.getText().toString();
  
                  Map&lt;String, String&gt; userMap = new HashMap&lt;&gt;();
                  userMap.put("Email Address", Email);
                  userMap.put("TP Number", TPnumber);
                  userMap.put("Department", Department);
                  userMap.put("Password", Password);
                  userMap.put("Confirm Pass", ConfirmPassword);
  
                  rFireStore.collection("Users").document("Students").set(userMap).addOnSuccessListener(new OnSuccessListener&lt;Void&gt;() {
                      @Override
                      public void onSuccess(Void aVoid) {
                          Toast.makeText(RegisterActivity.this, "Data Saved!!", Toast.LENGTH_SHORT).show();
                      }
                  }).addOnFailureListener(new OnFailureListener() {
                      @Override
                      public void onFailure(@NonNull Exception e) {
                          Toast.makeText(RegisterActivity.this, "Data Failed!!", Toast.LENGTH_SHORT).show();
                      }
                  });
  
                  /*rFireStore.collection("Users").add(userMap).addOnSuccessListener(new OnSuccessListener&lt;DocumentReference&gt;() {
                      @Override
                      public void onSuccess(DocumentReference documentReference) {
                          Toast.makeText(RegisterActivity.this, "Data Saved!!", Toast.LENGTH_SHORT).show();
                      }
                  }).addOnFailureListener(new OnFailureListener() {
                      @Override
                      public void onFailure(@NonNull Exception e) {
                          Toast.makeText(RegisterActivity.this, "Data Failed!!", Toast.LENGTH_SHORT).show();
                      }
                  });*/
              }
          });
      }
  }
  </code></pre>