Does anyone know what's wrong with my code, I'm trying to compare the input in my edit text field to ensure their equal value before it creates an account.
     //compare the fields contents
    if(editTextPassword.equals(editTextReEnterPassword)) {
        //they are equal
        //Creating a new user
        firebaseAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()){
                            finish();
                            startActivity(new Intent(getApplicationContext(), Home.class));
                        } else{
                            Toast.makeText(Register.this, "Could not register... please try again", Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }else {//they are not equal
        Toast.makeText(Register.this, "Passwords do not match... please try again", Toast.LENGTH_SHORT).show();
    }
 
     
    