How can I format an EditText to follow the "######-##-####" format or input mask in android? And this EditText only allow number. How can i do that? just an example, when the user enter 123456781234 it will change to 123456-78-1234 The Edittext will automatically put "-" using the number given. If anyone can help and show the code, it will help me alot. Thanks..
Asked
Active
Viewed 2,943 times
0
-
Refer this http://stackoverflow.com/questions/3890325/whats-the-best-way-to-apply-a-mask-to-an-edittext-on-android – Anil Jadhav Aug 12 '14 at 08:29
-
guys... If u can show the working code... it will help me.. i need it automatically put the "-" when the user enter the number in edittext... hope u can help... – Diana Hudson Aug 12 '14 at 08:47
1 Answers
0
Try this way,hope this will help you to solve your problem.
String formattedNumber = PhoneNumberUtils.formatNumber(unformattedNumber);
Take a look at PhoneNumberUtils for more options.

Haresh Chhelana
- 24,720
- 5
- 57
- 67
-
I hope u can show the working code... sorry, coz i'm new on this.. :( – Diana Hudson Aug 12 '14 at 08:39