title: Registration on firebase fail java android studio
body: <p>I am new at this and trying to understand why my codes don't work.</p>
  <p>There are no error but the following do not work</p>
  <ul>
  <li>No toast works apart the &quot;Authentication failed!&quot;</li>
  <li>when I sign up correctly, based all my restrictions, it crushes with error line 90 of the class</li>
  <li>once i register no info shows on firebase website, under authentication, user tab</li>
  </ul>
  <p>the codes below, please help</p>
  <pre><code>package com.mz4466.photowar;
  import android.annotation.SuppressLint;
  import android.content.Intent;
  import androidx.annotation.NonNull;
  import androidx.appcompat.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.TextUtils;
  import android.text.method.PasswordTransformationMethod;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  import android.widget.Toast;
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.AuthResult;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  
  public class RegisterActivity extends AppCompatActivity {
      DatabaseHelper db;
      EditText mTextUsername;
      EditText mTextPassword;
      EditText mTextCnfPassword;
      Button mButtonRegister;
      TextView mTextViewLogin;
      private FirebaseAuth mAuth;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_register);
  
  
          db = new DatabaseHelper(this);
          mAuth = FirebaseAuth.getInstance();
          mTextUsername = (EditText)findViewById(R.id.edittext_email);
          mTextPassword = (EditText)findViewById(R.id.edittext_password);
          mTextPassword.setTransformationMethod(new AsteriskPasswordTransformationMethod());
          mTextCnfPassword = (EditText)findViewById(R.id.edittext_cnf_password);
          mTextCnfPassword.setTransformationMethod(new AsteriskPasswordTransformationMethod());
          mButtonRegister = (Button)findViewById(R.id.button_register);
          mTextViewLogin = (TextView)findViewById(R.id.textview_login);
  
  
          mTextViewLogin.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Intent LoginIntent = new Intent(RegisterActivity.this,LoginActivity.class);
                  startActivity(LoginIntent);
              }
          });
  
  
          mButtonRegister.setOnClickListener(new View.OnClickListener() {
              @SuppressLint(&quot;ShowToast&quot;)
              @Override
              public void onClick(View view) {
                  String email = mTextUsername.getText().toString().trim();
                  String pwd = mTextPassword.getText().toString().trim();
                  String cnf_pwd = mTextCnfPassword.getText().toString().trim();
  
                  if (TextUtils.isEmpty(email)){
                      Toast.makeText(RegisterActivity.this, &quot;Please enter email&quot;, Toast.LENGTH_SHORT);
                      return;
                  }
                  if (TextUtils.isEmpty(pwd)) {
                      Toast.makeText(RegisterActivity.this, &quot;Please enter password&quot;, Toast.LENGTH_SHORT);
                      return;
                  }
                  if (TextUtils.isEmpty(cnf_pwd)) {
                      Toast.makeText(RegisterActivity.this, &quot;Please enter confirm password&quot;, Toast.LENGTH_SHORT);
                      return;
                  }
                  if (pwd.length()&lt;6){
                      Toast.makeText(RegisterActivity.this, &quot;Minimum 6 digit&quot;, Toast.LENGTH_SHORT);
                      return;
                  }
  
                  if(pwd.equals(cnf_pwd)){
                      mAuth.createUserWithEmailAndPassword(email, pwd)
                              .addOnCompleteListener(RegisterActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                                  @Override
                                  public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                                      if (!task.isSuccessful()) {
                                          startActivity(new Intent(getApplicationContext(),HomeActivity.class));
                                          Toast.makeText(RegisterActivity.this,&quot;You have registered!&quot;,Toast.LENGTH_SHORT).show();
                                      } else {
                                          Toast.makeText(RegisterActivity.this,&quot;Authentication Failed!&quot;,Toast.LENGTH_SHORT).show();
                                      }
                                  }
                              });
                  }
                  else{
                      Toast.makeText(RegisterActivity.this,&quot;Password is not matching&quot;,Toast.LENGTH_SHORT).show();
                  }
  
              }
          });
  
  
      }
  
      public class AsteriskPasswordTransformationMethod extends PasswordTransformationMethod {
          @Override
          public CharSequence getTransformation(CharSequence source, View view) {
              return new PasswordCharSequence(source);
          }
  
          private class PasswordCharSequence implements CharSequence {
              private CharSequence mSource;
              public PasswordCharSequence(CharSequence source) {
                  mSource = source; // Store char sequence
              }
              public char charAt(int index) {
                  return '*'; // This is the important part
              }
              public int length() {
                  return mSource.length(); // Return default
              }
              public CharSequence subSequence(int start, int end) {
                  return mSource.subSequence(start, end); // Return default
              }
          }
      }
  }
  </code></pre>
  <p>the activity is</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;@color/primary_light&quot;
      android:orientation=&quot;vertical&quot;
      android:gravity=&quot;center_horizontal&quot;
      tools:context=&quot;com.mz4466.photowar.RegisterActivity&quot;&gt;
  
      &lt;ImageView
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;250dp&quot;
          android:layout_marginTop=&quot;30sp&quot;
          app:srcCompat=&quot;@drawable/logo&quot;/&gt;
  
      &lt;EditText
          android:id=&quot;@+id/edittext_email&quot;
          android:layout_width=&quot;206dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_marginTop=&quot;10dp&quot;
          android:paddingLeft=&quot;2dp&quot;
          android:background=&quot;#ffffff&quot;
          android:drawableLeft=&quot;@drawable/username&quot;
          android:hint=&quot;@string/email&quot;/&gt;
  
      &lt;EditText
          android:id=&quot;@+id/edittext_password&quot;
          android:layout_width=&quot;206dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_marginTop=&quot;20dp&quot;
          android:background=&quot;#ffffff&quot;
          android:drawableLeft=&quot;@drawable/password&quot;
          android:hint=&quot;@string/password&quot;/&gt;
  
      &lt;EditText
          android:id=&quot;@+id/edittext_cnf_password&quot;
          android:layout_width=&quot;206dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_marginTop=&quot;20dp&quot;
          android:background=&quot;#ffffff&quot;
          android:drawableLeft=&quot;@drawable/password&quot;
          android:hint=&quot;@string/confirm_password&quot;/&gt;
      &lt;Button
          android:id=&quot;@+id/button_register&quot;
          android:layout_width=&quot;206dp&quot;
          android:layout_height=&quot;40dp&quot;
          android:layout_marginTop=&quot;20dp&quot;
          android:background=&quot;@color/accent&quot;
          android:textColor=&quot;@color/primary_text&quot;
          android:text=&quot;@string/register&quot;/&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;horizontal&quot;
          android:layout_marginTop=&quot;10dp&quot;&gt;
  
          &lt;TextView
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;35dp&quot;
              android:textColor=&quot;@color/primary_text&quot;
              android:text=&quot;@string/already_registered&quot;/&gt;
  
          &lt;TextView
              android:id=&quot;@+id/textview_login&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;35dp&quot;
              android:paddingLeft=&quot;10dp&quot;
              android:textStyle=&quot;bold&quot;
              android:textColor=&quot;@color/primary_text&quot;
              android:textSize=&quot;16sp&quot;
              android:text=&quot;@string/login&quot;/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>