I pulled contacts2.db from emulator(API 19) and checked contacts table. contacts table
It doesn't have display_name column.
However, after executing the following code,
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, REQUEST_CONTACT);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == REQUEST_DATE) {
...
} else if (requestCode == REQUEST_CONTACT && data != null) {
Uri contactUri = data.getData();
// Perform your query - the contactUri is like a "where" clause here
Cursor c = getActivity().getContentResolver().query(contactUri
, null
, null
, null
, null);
//cursor null check
try {
// Double-check that you actually got results
if (c.getCount() == 0) {
return;
}
c.moveToFirst();
String[] names = c.getColumnNames();
} finally {
c.close();
}
}
}
When I checked names, the list of columns is
sort_key
photo_uri
send_to_voicemail
contact_status
contact_status_label
pinned
display_name
phonebook_label_alt
phonebook_bucket
contact_status_res_package
photo_id
in_default_directory
custom_ringtone
_id
times_contacted
phonebook_label
lookup
display_name_alt
phonetic_name
last_time_contacted
contact_last_updated_timestamp
has_phone_number
in_visible_group
is_user_profile
display_name_source
photo_file_id
contact_status_ts
phonebook_bucket_alt
sort_key_alt
contact_presence
starred
photo_thumb_uri
contact_status_icon
contact_chat_capability
phonetic_name_style
name_raw_contact_id
It includes display_name column. How is it possible??