OnClickListener and OnCompleteListener<AuthResult> apparently not used (AwesomeValidation in Java for Android)

Viewed 13

So practicing with AwesomeValidation and Firebase I have tried to make a register for users using this code:

    btnRegister.setOnClickListener(**new View.OnClickListener()** {
        @Override
        public void onClick(View view) {
                String email = itEmail.getText().toString();
                String password = itPassword.getText().toString();

                if(awesomeValidation.validate()){
                    firebaseAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(**new OnCompleteListener<AuthResult>**() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if(task.isSuccessful()){
                                Toast.makeText(RegisterActivity.this, "Usuario creado", Toast.LENGTH_SHORT).show();
                                finish();
                            }else{
                                String error = ((FirebaseAuthException) task.getException()).getErrorCode();
                                Toast.makeText(RegisterActivity.this, error, Toast.LENGTH_SHORT).show();
                            }
                        }
                    });
                }else{
                    Toast.makeText(RegisterActivity.this,"Faltan datos",Toast.LENGTH_SHORT).show();
                }
            }
    });

But it seems that the objects created between ** ** are not used. (If using lambda the registration is not working neither). Any help?

0 Answers
Related