Search code examples
uriaddressbookandroid

Translating android phone number label id to string


Hi Im writing a small android app that is closely working whit phone labels but I don't understand how I'm suposed to translate the uri values described in the Documentation.

What i want to do is to translate TYPE_HOME To Home and so on. My current solution is to have a list of all translated string but it has presented a lot of problem with languish. But i want to be able to do it like the addresbook and other apps doses it.


Solution

  • Android has a built in method to do this already ...

    import android.provider.ContactsContract.CommonDataKinds.Phone;
    String s = (String) Phone.getTypeLabel(context.getResources(), Phone.TYPE_HOME, "");