How to get the following fields from Android contacts? I used Android 2.2.
- Name prefix
- First name
- Middle name
- Last name
- Name prefix
- Phonetic given name
- Phonetic middle name
- Phonetic family name
How to get the following fields from Android contacts? I used Android 2.2.
Experimenting with the
ContactsContract.Data.CONTENT_URI
in late 2015 on marshmallow. I'm unable to get theGIVEN_NAME
or similar fields. I think the later apis have deprecated these. Run the following code to print out the columns you have on your phoneCheck here there is example code exactly for that: http://developer.android.com/guide/topics/ui/layout/listview.html
As the other example (just for fun) but for fetching contact name of a single user:
try this,
Look at
ContactsContract.CommonDataKinds.StructuredName
class. You can find there all columns you are looking for. Try sth like this:It returns all names in contacts. To be more precise you can add a contact id as an additional parameter to the query - you will get address for particular contact.
For a specified contact you can do this :