1
My application is closing when I do a few clicks in the field, I found that it is trying to add twice mascara to 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 didn’t work.