Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#nestedclasses) \| [Constants](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#constants) \| [Inherited Constants](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#inhconstants) \| [Fields](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#lfields) \| [Methods](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#inhmethods)

# ContactsContract.Contacts

*** ** * ** ***

` public static class ContactsContract.Contacts `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/provider/BaseColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns, https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.ContactsContract.Contacts |

<br />

*** ** * ** ***

Constants for the contacts table, which contains a record per aggregate of raw contacts representing the same person.

### Operations


**Insert**
:
    A Contact cannot be created explicitly. When a raw contact is inserted, the provider will first try to find a Contact representing the same person. If one is found, the raw contact's `https://developer.android.com/reference/android/provider/ContactsContract.RawContactsColumns#CONTACT_ID` column gets the _ID of the aggregate Contact. If no match is found, the provider automatically inserts a new Contact and puts its _ID into the `https://developer.android.com/reference/android/provider/ContactsContract.RawContactsColumns#CONTACT_ID` column of the newly inserted raw contact.


**Update**
:
    Only certain columns of Contact are modifiable: `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#STARRED`, `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE`, `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL`. Changing any of these columns on the Contact also changes them on all constituent raw contacts.


**Delete**
:
    Be careful with deleting Contacts! Deleting an aggregate contact deletes all constituent raw contacts. The corresponding sync adapters will notice the deletions of their respective raw contacts and remove them from their back end storage.


**Query**
:
    - If you need to read an individual contact, consider using `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` instead of `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI`.
    - If you need to look up a contact by the phone number, use `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#CONTENT_FILTER_URI`, which is optimized for this purpose.
    - If you need to look up a contact by partial name, e.g. to produce filter-as-you-type suggestions, use the `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI` URI.
    - If you need to look up a contact by some data element like email address, nickname, etc, use a query against the `https://developer.android.com/reference/android/provider/ContactsContract.Data` table. The result will contain contact ID, name etc.

## Columns

| Contacts ||||
|---|---|---|---|
| long | `https://developer.android.com/reference/android/provider/BaseColumns#_ID` | read-only | Row ID. Consider using `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` instead. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` | read-only | An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation. |
| long | NAME_RAW_CONTACT_ID | read-only | The ID of the raw contact that contributes the display name to the aggregate contact. During aggregation one of the constituent raw contacts is chosen using a heuristic: a longer name or a name with more diacritic marks or more upper case characters is chosen. |
| String | DISPLAY_NAME_PRIMARY | read-only | The display name for the contact. It is the display name contributed by the raw contact referred to by the NAME_RAW_CONTACT_ID column. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID` | read-only | Reference to the row in the `https://developer.android.com/reference/android/provider/ContactsContract.Data` table holding the photo. That row has the mime type `https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.Photo#CONTENT_ITEM_TYPE`. The value of this field is computed automatically based on the `https://developer.android.com/reference/android/provider/ContactsContract.DataColumns#IS_SUPER_PRIMARY` field of the data rows of that mime type. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_URI` | read-only | A URI that can be used to retrieve the contact's full-size photo. This column is the preferred method of retrieving the contact photo. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI` | read-only | A URI that can be used to retrieve the thumbnail of contact's photo. This column is the preferred method of retrieving the contact photo. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP` | read-only | An indicator of whether this contact is supposed to be visible in the UI. "1" if the contact has at least one raw contact that belongs to a visible group; "0" otherwise. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER` | read-only | An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#STARRED` | read/write | An indicator for favorite contacts: '1' if favorite, '0' otherwise. When raw contacts are aggregated, this field is automatically computed: if any constituent raw contacts are starred, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE` | read/write | A custom ringtone associated with a contact. Typically this is the URI returned by an activity launched with the `https://developer.android.com/reference/android/media/RingtoneManager#ACTION_RINGTONE_PICKER` intent. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL` | read/write | An indicator of whether calls from this contact should be forwarded directly to voice mail ('1') or not ('0'). When raw contacts are aggregated, this field is automatically computed: if *all* constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts. |
| int | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_PRESENCE` | read-only | Contact IM presence status. See `https://developer.android.com/reference/android/provider/ContactsContract.StatusUpdates` for individual status definitions. Automatically computed as the highest presence of all constituent raw contacts. The provider may choose not to store this value in persistent storage. The expectation is that presence status will be updated on a regular basis. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS` | read-only | Contact's latest status update. Automatically computed as the latest of all constituent raw contacts' status updates. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_TIMESTAMP` | read-only | The absolute time in milliseconds when the latest status was inserted/updated. |
| String | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE` | read-only | The package containing resources for this status: label and icon. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_LABEL` | read-only | The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE`. |
| long | `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_ICON` | read-only | The resource ID of the icon for the source of contact status. This resource is scoped by the `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE`. |

<br />

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts.AggregationSuggestions` <br /> A *read-only* sub-directory of a single contact aggregate that contains all aggregation suggestions (other contacts). |
| ` class` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts.Data` A sub-directory of a single contact that contains all of the constituent raw contact `https://developer.android.com/reference/android/provider/ContactsContract.Data` rows. |
| ` class` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts.Entity` <br /> A sub-directory of a contact that contains all of its `https://developer.android.com/reference/android/provider/ContactsContract.RawContacts` as well as `https://developer.android.com/reference/android/provider/ContactsContract.Data` rows. |
| ` class` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts.Photo` A *read-only* sub-directory of a single contact that contains the contact's primary photo. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_ITEM_TYPE` The MIME type of a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` subdirectory of a single person. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_TYPE` The MIME type of `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` providing a directory of people. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_VCARD_TYPE` The MIME type of a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` subdirectory of a single person. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX` Add this query parameter to a URI to get back row counts grouped by the address book index as cursor extras. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX_COUNTS` The array of group counts for the corresponding group. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#EXTRA_ADDRESS_BOOK_INDEX_TITLES` The array of address book index titles, which are returned in the same order as the data in the cursor. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#QUERY_PARAMETER_VCARD_NO_PHOTO` Boolean parameter that may be used with `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI` and `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI` to indicate that the returned vcard should not contain a photo. |

### Inherited constants

From interface `https://developer.android.com/reference/android/provider/BaseColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_COUNT`

The count of rows in a directory.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/BaseColumns#_ID`

The unique ID for a row.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE`

<br />

An alternative representation of the display name, such as "family name first" instead of "given name first" for Western names.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_PRIMARY`

<br />

The standard text shown as the contact's display name, based on the best available information for the contact (for example, it might be the email address if the name is not available).
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_SOURCE`

The kind of data that is used as the display name for the contact, such as structured name or email address.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME`

<br />

Pronunciation of the full name in the phonetic alphabet specified by `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME_STYLE`.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME_STYLE`

The phonetic alphabet used to represent the `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#PHONETIC_NAME`.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_ALTERNATIVE`

Sort key based on the alternative representation of the full name, `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#DISPLAY_NAME_ALTERNATIVE`.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactNameColumns#SORT_KEY_PRIMARY`

Sort key that takes into account locale-based traditions for sorting names in address books.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#CUSTOM_RINGTONE`

URI for a custom ringtone associated with the contact.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED`

*This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This column always contains 0.*
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#PINNED`

The position at which the contact is pinned.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#SEND_TO_VOICEMAIL`

Whether the contact should always be sent to voicemail.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#STARRED`

Is the contact starred?

Type: INTEGER (boolean)

<br />

`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#TIMES_CONTACTED`

*This constant was deprecated in API level 29. Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This column always contains 0.*
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_CHAT_CAPABILITY`

Contact Chat Capabilities.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_PRESENCE`

Contact presence status.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS`

Contact's latest status update.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_ICON`

The resource ID of the icon for the source of contact status.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_LABEL`

The resource ID of the label describing the source of contact status, e.g. "Google Talk".
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_RES_PACKAGE`

The package containing resources for this status: label and icon.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactStatusColumns#CONTACT_STATUS_TIMESTAMP`

The absolute time in milliseconds when the latest status was inserted/updated.
From interface `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns` `https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#CONTACT_LAST_UPDATED_TIMESTAMP`

Timestamp (milliseconds since epoch) of when this contact was last updated.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#DISPLAY_NAME`

The display name for the contact.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#HAS_PHONE_NUMBER`

An indicator of whether this contact has at least one phone number.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_DEFAULT_DIRECTORY`

Flag that reflects whether the contact exists inside the default directory.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IN_VISIBLE_GROUP`

Flag that reflects the `https://developer.android.com/reference/android/provider/ContactsContract.GroupsColumns#GROUP_VISIBLE` state of any `https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.GroupMembership` for this contact.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#IS_USER_PROFILE`

Flag that reflects whether this contact represents the user's personal profile entry.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY`

An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#NAME_RAW_CONTACT_ID`

Reference to the row in the RawContacts table holding the contact name.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID`

Photo file ID of the full-size photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID`

Reference to the row in the data table holding the photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI`

A URI that can be used to retrieve a thumbnail of the contact's photo.
`https://developer.android.com/reference/java/lang/String` `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_URI`

A URI that can be used to retrieve the contact's full-size photo.

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI` The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` URI. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FREQUENT_URI` *This field was deprecated in API level 29. Frequent contacts are no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This URI always returns an empty cursor.* ***Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData) page.* |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_GROUP_URI` <br /> |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI` Base `https://developer.android.com/reference/android/net/Uri` for referencing multiple `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry, created by appending `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` using `https://developer.android.com/reference/android/net/Uri#withAppendedPath(android.net.Uri,%20java.lang.String)`. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_FILTER_URI` <br /> The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI` URI. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI` The content:// style URI for this table joined with useful data from `https://developer.android.com/reference/android/provider/ContactsContract.Data`, filtered to include only starred contacts. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` The content:// style URI for this table |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI` Base `https://developer.android.com/reference/android/net/Uri` for referencing a single `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry, created by appending `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` using `https://developer.android.com/reference/android/net/Uri#withAppendedPath(android.net.Uri,%20java.lang.String)`. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#ENTERPRISE_CONTENT_FILTER_URI` It supports the similar semantics as `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI` and returns the same columns. |
| ` public static final https://developer.android.com/reference/android/net/Uri` | `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#ENTERPRISE_CONTENT_URI` URI used for getting all contacts from both the calling user and the managed profile that is linked to it. |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#getLookupUri(android.content.ContentResolver,%20android.net.Uri)(https://developer.android.com/reference/android/content/ContentResolver resolver, https://developer.android.com/reference/android/net/Uri contactUri) ` Builds a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` style `https://developer.android.com/reference/android/net/Uri` describing the requested `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry. |
| ` static https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#getLookupUri(long,%20java.lang.String)(long contactId, https://developer.android.com/reference/java/lang/String lookupKey) ` Build a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` lookup `https://developer.android.com/reference/android/net/Uri` using the given `https://developer.android.com/reference/android/provider/BaseColumns#_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY`. |
| ` static boolean` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#isEnterpriseContactId(long)(long contactId) ` Return `true` if a contact ID is from the contacts provider on the managed profile. |
| ` static https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#lookupContact(android.content.ContentResolver,%20android.net.Uri)(https://developer.android.com/reference/android/content/ContentResolver resolver, https://developer.android.com/reference/android/net/Uri lookupUri) ` Computes a content URI (see `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI`) given a lookup URI. |
| ` static void` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#markAsContacted(android.content.ContentResolver,%20long)(https://developer.android.com/reference/android/content/ContentResolver resolver, long contactId) ` *This method was deprecated in API level 16. Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This method is no-op.* |
| ` static https://developer.android.com/reference/java/io/InputStream` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri)(https://developer.android.com/reference/android/content/ContentResolver cr, https://developer.android.com/reference/android/net/Uri contactUri) ` Opens an InputStream for the contacts's thumbnail photo and returns the photo as a byte stream. |
| ` static https://developer.android.com/reference/java/io/InputStream` | ` https://developer.android.com/reference/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri,%20boolean)(https://developer.android.com/reference/android/content/ContentResolver cr, https://developer.android.com/reference/android/net/Uri contactUri, boolean preferHighres) ` Opens an InputStream for the contacts's photo and returns the photo as a byte stream. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### CONTENT_ITEM_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String CONTENT_ITEM_TYPE
```

The MIME type of a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` subdirectory of a single person.

<br />

Constant Value: "vnd.android.cursor.item/contact"

### CONTENT_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String CONTENT_TYPE
```

The MIME type of `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` providing a directory of people.

<br />

Constant Value: "vnd.android.cursor.dir/contact"

### CONTENT_VCARD_TYPE

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String CONTENT_VCARD_TYPE
```

The MIME type of a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` subdirectory of a single person.

<br />

Constant Value: "text/x-vcard"

### EXTRA_ADDRESS_BOOK_INDEX

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_ADDRESS_BOOK_INDEX
```

Add this query parameter to a URI to get back row counts grouped by the address book index as cursor extras. For most languages it is the first letter of the sort key. This parameter does not affect the main content of the cursor.

<br />

```
Example:

import android.provider.ContactsContract.Contacts;

Uri uri = Contacts.CONTENT_URI.buildUpon()
         .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true")
         .build();
Cursor cursor = getContentResolver().query(uri,
         new String[] {Contacts.DISPLAY_NAME},
         null, null, null);
Bundle bundle = cursor.getExtras();
if (bundle.containsKey(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES) &&
        bundle.containsKey(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS)) {
    String sections[] =
            bundle.getStringArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES);
    int counts[] = bundle.getIntArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS);
}
```

<br />

<br />

<br />

Constant Value: "android.provider.extra.ADDRESS_BOOK_INDEX"

### EXTRA_ADDRESS_BOOK_INDEX_COUNTS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS
```

The array of group counts for the corresponding group. Contains the same number of elements as the EXTRA_ADDRESS_BOOK_INDEX_TITLES array.

TYPE: int\[\]

<br />

<br />

Constant Value: "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"

### EXTRA_ADDRESS_BOOK_INDEX_TITLES

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES
```

The array of address book index titles, which are returned in the same order as the data in the cursor.

TYPE: String\[\]

<br />

<br />

Constant Value: "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"

### QUERY_PARAMETER_VCARD_NO_PHOTO

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String QUERY_PARAMETER_VCARD_NO_PHOTO
```

Boolean parameter that may be used with `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_VCARD_URI` and `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_MULTI_VCARD_URI` to indicate that the returned vcard should not contain a photo. This is useful for obtaining a space efficient vcard.

<br />

Constant Value: "no_photo"

## Fields

### CONTENT_FILTER_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_FILTER_URI
```

The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` URI. The filter string will be used to match various parts of the contact name. The filter argument should be passed as an additional path segment after this URI.

<br />

### CONTENT_FREQUENT_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_FREQUENT_URI
```

<br />

**This field was deprecated in API level 29.**   

Frequent contacts are no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This URI always returns an empty cursor.

**Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData) page.

The content:// style URI for showing a list of frequently contacted people.

<br />

### CONTENT_GROUP_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_GROUP_URI
```

<br />

<br />

### CONTENT_LOOKUP_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_LOOKUP_URI
```

A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts. This URI should always be followed by a "/" and the contact's `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY`. It can optionally also have a "/" and last known contact ID appended after that. This "complete" format is an important optimization and is highly recommended.

As long as the contact's row ID remains the same, this URI is equivalent to `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI`. If the contact's row ID changes as a result of a sync or aggregation, this URI will look up the contact using indirect information (sync IDs or constituent raw contacts).

Lookup key should be appended unencoded - it is stored in the encoded form, ready for use in a URI.

<br />

### CONTENT_MULTI_VCARD_URI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_MULTI_VCARD_URI
```

Base `https://developer.android.com/reference/android/net/Uri` for referencing multiple `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry, created by appending `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` using `https://developer.android.com/reference/android/net/Uri#withAppendedPath(android.net.Uri,%20java.lang.String)`. The lookup keys have to be joined with the colon (":") separator, and the resulting string encoded. Provides `https://developer.android.com/reference/android/provider/OpenableColumns` columns when queried, or returns the referenced contact formatted as a vCard when opened through `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)`.

Usage example:


The following code snippet creates a multi-vcard URI that references all the contacts in a user's database.
:

    ```
    public Uri getAllContactsVcardUri() {
        Cursor cursor = getActivity().getContentResolver().query(Contacts.CONTENT_URI,
            new String[] {Contacts.LOOKUP_KEY}, null, null, null);
        if (cursor == null) {
            return null;
        }
        try {
            StringBuilder uriListBuilder = new StringBuilder();
            int index = 0;
            while (cursor.moveToNext()) {
                if (index != 0) uriListBuilder.append(':');
                uriListBuilder.append(cursor.getString(0));
                index++;
            }
            return Uri.withAppendedPath(Contacts.CONTENT_MULTI_VCARD_URI,
                    Uri.encode(uriListBuilder.toString()));
        } finally {
            cursor.close();
        }
    }
    ```

    <br />


    <br />


    <br />


### CONTENT_STREQUENT_FILTER_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_STREQUENT_FILTER_URI
```

<br />

The content:// style URI used for "type-to-filter" functionality on the `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_STREQUENT_URI` URI. The filter string will be used to match various parts of the contact name. The filter argument should be passed as an additional path segment after this URI.

**Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData) page.

<br />

### CONTENT_STREQUENT_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_STREQUENT_URI
```

The content:// style URI for this table joined with useful data from `https://developer.android.com/reference/android/provider/ContactsContract.Data`, filtered to include only starred contacts. Frequent contacts are no longer included in the result as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`.

**Caution:** If you publish your app to the Google Play Store, this field doesn't sort results based on contacts frequency. For more information, see the [Contacts Provider](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData) page.

<br />

### CONTENT_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_URI
```

The content:// style URI for this table

<br />

### CONTENT_VCARD_URI

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri CONTENT_VCARD_URI
```

Base `https://developer.android.com/reference/android/net/Uri` for referencing a single `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry, created by appending `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` using `https://developer.android.com/reference/android/net/Uri#withAppendedPath(android.net.Uri,%20java.lang.String)`. Provides `https://developer.android.com/reference/android/provider/OpenableColumns` columns when queried, or returns the referenced contact formatted as a vCard when opened through `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)`.

<br />

### ENTERPRISE_CONTENT_FILTER_URI

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri ENTERPRISE_CONTENT_FILTER_URI
```

It supports the similar semantics as `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI` and returns the same columns. This URI requires `https://developer.android.com/reference/android/provider/ContactsContract#DIRECTORY_PARAM_KEY` in parameters, otherwise it will throw IllegalArgumentException. The passed directory can belong either to the calling user or to a managed profile that is linked to it.

<br />

### ENTERPRISE_CONTENT_URI

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Uri ENTERPRISE_CONTENT_URI
```

URI used for getting all contacts from both the calling user and the managed profile that is linked to it.

It supports the same semantics as `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` and returns the same columns.  

If the calling user has no managed profile, it behaves in the exact same way as `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI`.  

If there is a managed profile linked to the calling user, it will return merged results from both.

Note: this query returns the calling user results before the managed profile results, and this order is not affected by the sorting parameter.

If a result is from the managed profile, the following changes are made to the data:

- `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_THUMBNAIL_URI` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_URI` will be rewritten to special URIs. Use `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)` or its siblings to load pictures from them.
- `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID` will be set to null. Don't use them.
- `https://developer.android.com/reference/android/provider/BaseColumns#_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY` will be replaced with artificial values. These values will be consistent across multiple queries, but do not use them in places that do not explicitly say they accept them. If they are used in the `selection` param in `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)`, the result is undefined.
- In order to tell whether a contact is from the managed profile, use `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#isEnterpriseContactId(long)`.

  <br />

  <br />

## Public methods

### getLookupUri

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Uri getLookupUri (ContentResolver resolver, 
                Uri contactUri)
```

Builds a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` style `https://developer.android.com/reference/android/net/Uri` describing the requested `https://developer.android.com/reference/android/provider/ContactsContract.Contacts` entry.

<br />

| Parameters ||
|---|---|
| `resolver` | `ContentResolver` <br /> |
| `contactUri` | `Uri`: A `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` row, or an existing `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` to attempt refreshing. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | <br /> |

### getLookupUri

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Uri getLookupUri (long contactId, 
                String lookupKey)
```

Build a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` lookup `https://developer.android.com/reference/android/net/Uri` using the given `https://developer.android.com/reference/android/provider/BaseColumns#_ID` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns#LOOKUP_KEY`.

Returns null if unable to construct a valid lookup URI from the provided parameters.

<br />

| Parameters ||
|---|---|
| `contactId` | `long` <br /> |
| `lookupKey` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | <br /> |

### isEnterpriseContactId

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isEnterpriseContactId (long contactId)
```

Return `true` if a contact ID is from the contacts provider on the managed profile. `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup#ENTERPRISE_CONTENT_FILTER_URI` and similar APIs may return such IDs.

<br />

| Parameters ||
|---|---|
| `contactId` | `long` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### lookupContact

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Uri lookupContact (ContentResolver resolver, 
                Uri lookupUri)
```

Computes a content URI (see `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI`) given a lookup URI.

Returns null if the contact cannot be found.

<br />

| Parameters ||
|---|---|
| `resolver` | `ContentResolver` <br /> |
| `lookupUri` | `Uri` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | <br /> |

### markAsContacted

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void markAsContacted (ContentResolver resolver, 
                long contactId)
```

<br />

**This method was deprecated in API level 16.**   

Contacts affinity information is no longer supported as of Android version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q`. This method is no-op.

Mark a contact as having been contacted. Updates two fields: `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#TIMES_CONTACTED` and `https://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns#LAST_TIME_CONTACTED`. The TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED field is populated with the current system time.

**Caution:** If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the [Contacts Provider](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData) page.

<br />

<br />

| Parameters ||
|---|---|
| `resolver` | `ContentResolver`: the ContentResolver to use <br /> |
| `contactId` | `long`: the person who was contacted <br /> |

### openContactPhotoInputStream

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static InputStream openContactPhotoInputStream (ContentResolver cr, 
                Uri contactUri)
```

Opens an InputStream for the contacts's thumbnail photo and returns the photo as a byte stream.

<br />

| Parameters ||
|---|---|
| `cr` | `ContentResolver`: The content resolver to use for querying <br /> |
| `contactUri` | `Uri`: the contact whose photo should be used. This can be used with either a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` or a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` URI. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/io/InputStream` | an InputStream of the photo, or null if no photo is present <br /> |

**See also:**

- `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#openContactPhotoInputStream(android.content.ContentResolver,%20android.net.Uri,%20boolean)`

### openContactPhotoInputStream

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static InputStream openContactPhotoInputStream (ContentResolver cr, 
                Uri contactUri, 
                boolean preferHighres)
```

Opens an InputStream for the contacts's photo and returns the photo as a byte stream.

<br />

| Parameters ||
|---|---|
| `cr` | `ContentResolver`: The content resolver to use for querying <br /> |
| `contactUri` | `Uri`: the contact whose photo should be used. This can be used with either a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_URI` or a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI` URI. <br /> |
| `preferHighres` | `boolean`: If this is true and the contact has a higher resolution photo available, it is returned. If false, this function always tries to get the thumbnail <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/io/InputStream` | an InputStream of the photo, or null if no photo is present <br /> |