Make a condition to apply mascara to an Edittext

Asked

Viewed 93 times

0

I can’t make a condition to apply mascara in an editText 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);
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.