title: I want my signup button to go back to login after clicked
body: <p><em>Hello I encounter some problem in this code, after signing up I want it to back to login so user must verify first the email and then login before entering the app but when I click my btnSignUp it goes directly to my home activity.
  Here is the code:</em></p>
  <p><a href="https://i.stack.imgur.com/tXYfI.png" rel="nofollow noreferrer">enter image description here</a><a href="https://i.stack.imgur.com/p0VWJ.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>btnSignUp.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              String email = edtEmail.getText().toString().trim();
              String pass = EdtPass.getText().toString().trim();
              String confpass = edtConPass.getText().toString().trim();
              if(email.isEmpty() || pass.isEmpty() || confpass.isEmpty()){
                  Toast.makeText(getApplicationContext(), &quot;Fill all fields&quot;, Toast.LENGTH_SHORT).show();
              }
              else if(pass.length() &lt;7 || !pass.matches(confpass)){
                  Toast.makeText(getApplicationContext(), &quot;Password must above 7 characters or your password entered does not match.&quot;, Toast.LENGTH_SHORT).show();
              }
              else
              {
                  firebaseauth.createUserWithEmailAndPassword(email, pass).addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if(task.isSuccessful()){
                              Toast.makeText(getApplicationContext(), &quot;Registration Successful&quot;, Toast.LENGTH_SHORT).show();
                              sendEmailVerification();
  
                          }
                          else{
                              Toast.makeText(getApplicationContext(), &quot;Failed to register.&quot;, Toast.LENGTH_SHORT).show();
                          }
                      }
                  });
              }
          }
      });
  
  
  }
  private void sendEmailVerification(){
      FirebaseUser firebaseUser = firebaseauth.getCurrentUser();
      if(firebaseUser!=null){
          firebaseUser.sendEmailVerification().addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
              @Override
              public void onComplete(@NonNull Task&lt;Void&gt; task) {
                  Toast.makeText(getApplicationContext(), &quot;Verification email sent, Verify and login.&quot;, Toast.LENGTH_SHORT).show();
                  Intent intent = new Intent(signUp.this,MainActivity.class);
                  startActivity(intent);
  
              }
          });
      }
      else{
          Toast.makeText(getApplicationContext(), &quot;Failed to send email verification.&quot;, Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>