L
L
lahomie932018-10-28 23:57:11
Android
lahomie93, 2018-10-28 23:57:11

How are phone numbers formatted in Android?

Hello. I need help with the following problem. In my application, I need to display a list of calls. The customer wants the application to format calls in the same way as in the standard call list:
5bd6213fe20de274280524.jpeg
To format numbers starting with +7, I use the formatNumber method , which allows me to adequately receive Russian numbers of the form +7 XXX XXX-XX-XX, if the second parameter I pass "RU". But for other numbers of the form 8(ХХХ) ХХХ-ХХ-ХХ this method does not work - the number simply consists of numbers
Tell me, how can I achieve the correct formatting of all numbers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-10-29
@akaish

If you want formatting, as in the "contacts" system application - just look at how it's done in the source code of this very application.
Link to git with sources

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question