I can not make a condition to apply mascara to an editText does anyone help me please?
final EditText tel = (EditText) findViewById(R.id.phone);
// Armazene seus TextWatcher para posterior uso
//telMask = Mask.insert("(##)#########", tel);
String digControle = String.valueOf(tel.getText().toString().charAt(4));
//char numero = tel.getText().toString().charAt(4);
if (digControle.equals(9)) {
telMask = Mask.insert("(##)#####-####", tel);
} else {
telMask = Mask.insert("(##)####-####", tel);
}
tel.addTextChangedListener(telMask);