Instead of 5118710, it should be 511-8710. I\'d like to add a dash after the user the user inputted 3 digits already in the EditText. The maximum length of
The most straightforward solution is to use PhoneNumberFormattingTextWatcher which will format the number according to the system locale.
XML:
Add addTextChangedListener() in your class:
EditText phoneNumber = (EditText)findViewById(R.id.phone_number);
phoneNumber.addTextChangedListener(new PhoneNumberFormattingTextWatcher());