My application is closing when I make a few clicks in the field, I noticed that it is trying to double-mask the field.
@FocusChange(R.id.edtTelefone)
void focusAlterado(View v, boolean hasFocus) {
String telefone = edtTelefone.getText().toString();
MaskEditTextChangedListener maskTEL = new MaskEditTextChangedListener("(##) #### ####", edtTelefone);
if(!hasFocus) {
if(telefone.length() != 14) {
edtTelefone.addTextChangedListener(maskTEL);
a++;
}
}else{
if(telefone.length() == 0){
edtTelefone.addTextChangedListener(maskTEL);
a++;
}else if(a != 1){
edtTelefone.addTextChangedListener(maskTEL);
a++;
}
}
}
I tried to do this trick of a
but it did not work.