I want to make user inputted phone number in an editText to dynamically change format every time the user inputs a number. That is, when user inputs up to 4 digits, like 7144, the editText shows “714-4”.
I would like the editText to be dynamically updated to format ###-###-#### whenever the user inputs a digit. how can this be done? also, I am handling more than one editTexts.
I want to make user inputted phone number in an editText to dynamically change
Share
Easiest way to do this is to use the built in Android PhoneNumberFormattingTextWatcher.
So basically you get your EditText in code and set your text watcher like this…
Nice thing about using PhoneNumberFormattingTextWatcher is that it will format your number entry correctly based on your locale.