views:

32

answers:

1

When changing the custom locale the label of the phone types change to the appropriate language. Does anybody know how to get the localized label of the phone types?

I pick a contact in my app to get its phone number and if there is more then one number I use an AlertDialog to let the user select the currect one. In this pick list, I want to show the label of the type, so it's easier for the user to select. Since they labels are somewhere in the Android system, it must be possible to get the localized label. Unfortunately, the Phone.LABEL is null when reading the phone number.

+1  A: 

Inferno's answer is a valid answer, and I was happy to find this answer because it was similar to what I was looking for. However, if you're dealing with phones installed with API Level 5 (Android 2.0) or newer, there is one small problem with this: android.R.array.phoneTypes only returns the list of phone types that were present prior to when ContactsContract class replaced the Contacts interface as of API Level 5. I verified the labels listed when creating a new contact on emulators running these Android versions (API Levels): 1.6 (4), 2.1-update 1 (7), and 2.2 (8).

When printed out, android.R.array.phoneTypes contains these valid phone types:
Home, Mobile, Work, Work Fax, Home Fax, Pager, Other, Custom

These are the valid phone types, present for phones with Android 2.0+ installed, that are missing from that same Array:
Callback, Car, Company Main, ISDN, Main, Other Fax, Radio, Telex, TTY TDD, Work Mobile, Work Pager, Assistant, MMS

Unfortunately, I have not been able to find something like android.R.array.phoneTypes that'll list all of these valid phone types for phones Android 2.0+. Has anyone come across such yet?

References

android.R.array.phoneTypes defined: http://developer.android.com/reference/android/R.array.html#phoneTypes

Note: I'm posting my other two reference links in separate answers, as I can't seem to post more than one hyperlink per post at this time.

Crystie
Valid Phone Types pre-Android 2.0 (pre-`ContactsContract`): http://developer.android.com/reference/android/provider/Contacts.PhonesColumns.html
Crystie
Valid Phone Types for Android 2.0+: http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Phone.html
Crystie