0
I would like to know that a certain Button has been clicked, so that it does not pass the null validation. Follows code:
//OnClick da tela de registro
btnRegistrar = (Button)findViewById(R.id.email_registrar_button);
btnRegistrar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
intent = new Intent(LoginActivity.this,RegistrarActivity.class);
//startNewIntent("registrar");
}
});
But before opening Activity he passes this validation:
if ((TextUtils.isEmpty(email) || TextUtils.isEmpty(password) && (!btnRegistrar.isPressed()))) {
mEmailView.setError(getString(R.string.error_field_required));
mPasswordView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
This "isPressed()" was one of the trials. Thank you!
Edit: When clicking the button it calls this validation, I used the login template of android studio
Edti2: Rewritten the question, it was an encoding error. I cannot delete the question.
You will only register if the button is not pressed ?
– Lucas Queiroz Ribeiro
Ever thought about using a global variable as a flag? or don’t like doing gamibarra hehe
– mau humor
Oops, maybe the description was incomplete, I tried to use the flag, but even putting the onclick, it passes first in this validation, is out of onclick. I used the login time of own android studio
– Henrique
@Lucasqueirozribeiro The registration screen will open only if the button is pressed
– Henrique
Answer as you solved and mark as closed, or choose one of the answers
– Lucas Queiroz Ribeiro
@Lucasqueirozribeiro I don’t know how to close, or doesn’t appear to me
– Henrique