共用方式為


ContactsContract.Contacts Class

Definition

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

[Android.Runtime.Register("android/provider/ContactsContract$Contacts", DoNotGenerateAcw=true)]
public class ContactsContract.Contacts : Java.Lang.Object
[<Android.Runtime.Register("android/provider/ContactsContract$Contacts", DoNotGenerateAcw=true)>]
type ContactsContract.Contacts = class
    inherit Object
Inheritance
ContactsContract.Contacts
Attributes

Remarks

Constants for the contacts table, which contains a record per aggregate of raw contacts representing the same person. <h3>Operations</h3> <dl> <dt><b>Insert</b></dt> <dd>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 RawContacts#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 RawContacts#CONTACT_ID column of the newly inserted raw contact.</dd> <dt><b>Update</b></dt> <dd>Only certain columns of Contact are modifiable: #STARRED, #CUSTOM_RINGTONE, #SEND_TO_VOICEMAIL. Changing any of these columns on the Contact also changes them on all constituent raw contacts.</dd> <dt><b>Delete</b></dt> <dd>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.</dd> <dt><b>Query</b></dt> <dd> <ul> <li>If you need to read an individual contact, consider using #CONTENT_LOOKUP_URI instead of #CONTENT_URI.</li> <li>If you need to look up a contact by the phone number, use PhoneLookup#CONTENT_FILTER_URI PhoneLookup.CONTENT_FILTER_URI, which is optimized for this purpose.</li> <li>If you need to look up a contact by partial name, e.g. to produce filter-as-you-type suggestions, use the #CONTENT_FILTER_URI URI. <li>If you need to look up a contact by some data element like email address, nickname, etc, use a query against the ContactsContract.Data table. The result will contain contact ID, name etc. </ul> </dd> </dl> <h2>Columns</h2> <table class="jd-sumtable"> <tr> <th colspan='4'>Contacts</th> </tr> <tr> <td>long</td> <td>#_ID</td> <td>read-only</td> <td>Row ID. Consider using #LOOKUP_KEY instead.</td> </tr> <tr> <td>String</td> <td>#LOOKUP_KEY</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>long</td> <td>NAME_RAW_CONTACT_ID</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>String</td> <td>DISPLAY_NAME_PRIMARY</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>long</td> <td>#PHOTO_ID</td> <td>read-only</td> <td>Reference to the row in the ContactsContract.Data table holding the photo. That row has the mime type CommonDataKinds.Photo#CONTENT_ITEM_TYPE. The value of this field is computed automatically based on the CommonDataKinds.Photo#IS_SUPER_PRIMARY field of the data rows of that mime type.</td> </tr> <tr> <td>long</td> <td>#PHOTO_URI</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>long</td> <td>#PHOTO_THUMBNAIL_URI</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>int</td> <td>#IN_VISIBLE_GROUP</td> <td>read-only</td> <td>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.</td> </tr> <tr> <td>int</td> <td>#HAS_PHONE_NUMBER</td> <td>read-only</td> <td>An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise.</td> </tr> <tr> <td>int</td> <td>#STARRED</td> <td>read/write</td> <td>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.</td> </tr> <tr> <td>String</td> <td>#CUSTOM_RINGTONE</td> <td>read/write</td> <td>A custom ringtone associated with a contact. Typically this is the URI returned by an activity launched with the android.media.RingtoneManager#ACTION_RINGTONE_PICKER intent.</td> </tr> <tr> <td>int</td> <td>#SEND_TO_VOICEMAIL</td> <td>read/write</td> <td>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.</td> </tr> <tr> <td>int</td> <td>#CONTACT_PRESENCE</td> <td>read-only</td> <td>Contact IM presence status. See 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.</td> </tr> <tr> <td>String</td> <td>#CONTACT_STATUS</td> <td>read-only</td> <td>Contact's latest status update. Automatically computed as the latest of all constituent raw contacts' status updates.</td> </tr> <tr> <td>long</td> <td>#CONTACT_STATUS_TIMESTAMP</td> <td>read-only</td> <td>The absolute time in milliseconds when the latest status was inserted/updated.</td> </tr> <tr> <td>String</td> <td>#CONTACT_STATUS_RES_PACKAGE</td> <td>read-only</td> <td> The package containing resources for this status: label and icon.</td> </tr> <tr> <td>long</td> <td>#CONTACT_STATUS_LABEL</td> <td>read-only</td> <td>The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the #CONTACT_STATUS_RES_PACKAGE.</td> </tr> <tr> <td>long</td> <td>#CONTACT_STATUS_ICON</td> <td>read-only</td> <td>The resource ID of the icon for the source of contact status. This resource is scoped by the #CONTACT_STATUS_RES_PACKAGE.</td> </tr> </table>

Java documentation for android.provider.ContactsContract.Contacts.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

ContactsContract.Contacts(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ContentItemType

The MIME type of a #CONTENT_URI subdirectory of a single person.

ContentType

The MIME type of #CONTENT_URI providing a directory of people.

ContentVcardType

The MIME type of a #CONTENT_URI subdirectory of a single person.

ExtraAddressBookIndex
ExtraAddressBookIndexCounts
ExtraAddressBookIndexTitles
QueryParameterVcardNoPhoto

Boolean parameter that may be used with #CONTENT_VCARD_URI and #CONTENT_MULTI_VCARD_URI to indicate that the returned vcard should not contain a photo.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
ContentFilterUri

The content:// style URI used for "type-to-filter" functionality on the #CONTENT_URI URI.

ContentFrequentUri

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

ContentGroupUri
ContentLookupUri

A content:// style URI for this table that should be used to create shortcuts or otherwise create long-term links to contacts.

ContentMultiVcardUri

Base Uri for referencing multiple Contacts entry, created by appending #LOOKUP_KEY using Uri#withAppendedPath(Uri, String).

ContentStrequentFilterUri

The content:// style URI used for "type-to-filter" functionality on the #CONTENT_STREQUENT_URI URI.

ContentStrequentUri

The content:// style URI for this table joined with useful data from ContactsContract.Data, filtered to include only starred contacts.

ContentUri

The content:// style URI for this table

ContentVcardUri

Base Uri for referencing a single Contacts entry, created by appending #LOOKUP_KEY using Uri#withAppendedPath(Uri, String).

EnterpriseContentFilterUri

It supports the similar semantics as #CONTENT_FILTER_URI and returns the same columns.

EnterpriseContentUri

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

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLookupUri(ContentResolver, Uri)

Builds a #CONTENT_LOOKUP_URI style Uri describing the requested Contacts entry.

GetLookupUri(Int64, String)

Build a #CONTENT_LOOKUP_URI lookup Uri using the given ContactsContract.Contacts#_ID and #LOOKUP_KEY.

IsEnterpriseContactId(Int64)

Return true if a contact ID is from the contacts provider on the managed profile.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LookupContact(ContentResolver, Uri)

Computes a content URI (see #CONTENT_URI) given a lookup URI.

MarkAsContacted(ContentResolver, Int64)
Obsolete.

Mark a contact as having been contacted.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OpenContactPhotoInputStream(ContentResolver, Uri, Boolean)

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

OpenContactPhotoInputStream(ContentResolver, Uri)

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

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to