public static final class ContactsContract.CommonDataKinds.Email extends Object implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns
A data kind representing an email address.
You can use all columns defined for ContactsContract.Data
as
well as the following aliases.
Type | Alias | Data column | |
---|---|---|---|
String | ADDRESS |
ContactsContract.DataColumns.DATA1 |
Email address itself. |
int | ContactsContract.CommonDataKinds.CommonColumns.TYPE |
ContactsContract.DataColumns.DATA2 |
Allowed values are:
|
String | ContactsContract.CommonDataKinds.CommonColumns.LABEL |
ContactsContract.DataColumns.DATA3 |
Modifier and Type | Field and Description |
---|---|
static String |
ADDRESS
The email address.
|
static Uri |
CONTENT_FILTER_URI
The content:// style URL for email lookup using a filter.
|
static String |
CONTENT_ITEM_TYPE
MIME type used when storing this in data table.
|
static Uri |
CONTENT_LOOKUP_URI
The content:// style URL for looking up data rows by email address.
|
static String |
CONTENT_TYPE
The MIME type of
CONTENT_URI providing a directory of email addresses. |
static Uri |
CONTENT_URI
The content:// style URI for all data records of the
CONTENT_ITEM_TYPE MIME type, combined with the
associated raw contact and aggregate contact data. |
static String |
DISPLAY_NAME
The display name for the email address
Type: TEXT
|
static Uri |
ENTERPRISE_CONTENT_FILTER_URI
It supports the similar semantics as
CONTENT_FILTER_URI and returns the same
columns. |
static Uri |
ENTERPRISE_CONTENT_LOOKUP_URI
URI used for enterprise email lookup.
|
static 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.
|
static String |
EXTRA_ADDRESS_BOOK_INDEX_COUNTS
The array of group counts for the corresponding group.
|
static 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.
|
static int |
TYPE_HOME |
static int |
TYPE_MOBILE |
static int |
TYPE_OTHER |
static int |
TYPE_WORK |
_COUNT, _ID
CARRIER_PRESENCE, CARRIER_PRESENCE_VT_CAPABLE, DATA_VERSION, DATA1, DATA10, DATA11, DATA12, DATA13, DATA14, DATA15, DATA2, DATA3, DATA4, DATA5, DATA6, DATA7, DATA8, DATA9, HASH_ID, IS_PRIMARY, IS_READ_ONLY, IS_SUPER_PRIMARY, MIMETYPE, RAW_CONTACT_ID, RES_PACKAGE, SYNC1, SYNC2, SYNC3, SYNC4
AVAILABLE, AWAY, CAPABILITY_HAS_CAMERA, CAPABILITY_HAS_VIDEO, CAPABILITY_HAS_VOICE, CHAT_CAPABILITY, DO_NOT_DISTURB, IDLE, INVISIBLE, OFFLINE, PRESENCE, PRESENCE_CUSTOM_STATUS, PRESENCE_STATUS, STATUS, STATUS_ICON, STATUS_LABEL, STATUS_RES_PACKAGE, STATUS_TIMESTAMP
ACCOUNT_TYPE_AND_DATA_SET, AGGREGATION_MODE, BACKUP_ID, CONTACT_ID, DATA_SET, DELETED, METADATA_DIRTY, RAW_CONTACT_IS_READ_ONLY, RAW_CONTACT_IS_USER_PROFILE
CONTACT_LAST_UPDATED_TIMESTAMP, HAS_PHONE_NUMBER, IN_DEFAULT_DIRECTORY, IN_VISIBLE_GROUP, IS_USER_PROFILE, LOOKUP_KEY, NAME_RAW_CONTACT_ID, PHOTO_FILE_ID, PHOTO_ID, PHOTO_THUMBNAIL_URI, PHOTO_URI
DISPLAY_NAME_ALTERNATIVE, DISPLAY_NAME_PRIMARY, DISPLAY_NAME_SOURCE, PHONETIC_NAME, PHONETIC_NAME_STYLE, SORT_KEY_ALTERNATIVE, SORT_KEY_PRIMARY
CUSTOM_RINGTONE, LAST_TIME_CONTACTED, PINNED, SEND_TO_VOICEMAIL, STARRED, TIMES_CONTACTED
CONTACT_CHAT_CAPABILITY, CONTACT_PRESENCE, CONTACT_STATUS, CONTACT_STATUS_ICON, CONTACT_STATUS_LABEL, CONTACT_STATUS_RES_PACKAGE, CONTACT_STATUS_TIMESTAMP
LAST_TIME_USED, TIMES_USED
DATA, LABEL, TYPE
TYPE_CUSTOM
Modifier and Type | Method and Description |
---|---|
static CharSequence |
getTypeLabel(Resources res,
int type,
CharSequence label)
Return a
CharSequence that best describes the given type,
possibly substituting the given ContactsContract.CommonDataKinds.CommonColumns.LABEL value
for ContactsContract.CommonDataKinds.BaseTypes.TYPE_CUSTOM . |
static int |
getTypeLabelResource(int type)
Return the string resource that best describes the given
ContactsContract.CommonDataKinds.CommonColumns.TYPE . |
public static final String CONTENT_ITEM_TYPE
public static final String CONTENT_TYPE
CONTENT_URI
providing a directory of email addresses.public static final Uri CONTENT_URI
CONTENT_ITEM_TYPE
MIME type, combined with the
associated raw contact and aggregate contact data.public static final Uri CONTENT_LOOKUP_URI
The content:// style URL for looking up data rows by email address. The lookup argument, an email address, should be passed as an additional path segment after this URI.
Example:
Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(email)); Cursor c = getContentResolver().query(uri, new String[]{Email.CONTACT_ID, Email.DISPLAY_NAME, Email.DATA}, null, null, null);
public static final Uri ENTERPRISE_CONTENT_LOOKUP_URI
URI used for enterprise email lookup.
It supports the same semantics as CONTENT_LOOKUP_URI
and returns the same
columns. If the device has no corp profile that is linked to the current profile, it
behaves in the exact same way as CONTENT_LOOKUP_URI
. If there is a
corp profile linked to the current profile, it first queries against the personal contact database,
and if no matching contacts are found there, then queries against the
corp contacts database.
If a result is from the corp profile, it makes the following changes to the data:
ContactsContract.ContactsColumns.PHOTO_THUMBNAIL_URI
and ContactsContract.ContactsColumns.PHOTO_URI
will be rewritten to special
URIs. Use ContentResolver.openAssetFileDescriptor(android.net.Uri, java.lang.String)
or its siblings to
load pictures from them.
ContactsContract.ContactsColumns.PHOTO_ID
and ContactsContract.ContactsColumns.PHOTO_FILE_ID
will be set to null. Do not
use them.
ContactsContract.RawContactsColumns.CONTACT_ID
s. In order to tell whether
a contact
is from the corp profile, use
ContactsContract.Contacts.isEnterpriseContactId(long)
.
ContactsContract.ContactsColumns.LOOKUP_KEY
s too.
A contact lookup URL built by
ContactsContract.Contacts.getLookupUri(long, String)
with an BaseColumns._ID
and a ContactsContract.ContactsColumns.LOOKUP_KEY
returned by this API can be passed to
ContactsContract.QuickContact.showQuickContact(android.content.Context, android.view.View, android.net.Uri, int, java.lang.String[])
even if a contact is from the
corp profile.
Uri lookupUri = Uri.withAppendedPath(Email.ENTERPRISE_CONTENT_LOOKUP_URI, Uri.encode(email));
public static final Uri CONTENT_FILTER_URI
The content:// style URL for email lookup using a filter. The filter returns
records of MIME type CONTENT_ITEM_TYPE
. The filter is applied
to display names as well as email addresses. The filter argument should be passed
as an additional path segment after this URI.
The query in the following example will return "Robert Parr (bob@incredibles.com)" as well as "Bob Parr (incredible@android.com)".
Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode("bob")); Cursor c = getContentResolver().query(uri, new String[]{Email.DISPLAY_NAME, Email.DATA}, null, null, null);
public static final Uri ENTERPRISE_CONTENT_FILTER_URI
CONTENT_FILTER_URI
and returns the same
columns. This URI requires ContactsContract.DIRECTORY_PARAM_KEY
in
parameters, otherwise it will throw IllegalArgumentException.public static final String ADDRESS
Type: TEXT
public static final int TYPE_HOME
public static final int TYPE_WORK
public static final int TYPE_OTHER
public static final int TYPE_MOBILE
public static final String DISPLAY_NAME
Type: TEXT
public static final String EXTRA_ADDRESS_BOOK_INDEX
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); }
public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES
TYPE: String[]
public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS
TYPE: int[]
public static final int getTypeLabelResource(int type)
ContactsContract.CommonDataKinds.CommonColumns.TYPE
. Will always return a valid resource.public static final CharSequence getTypeLabel(Resources res, int type, CharSequence label)
CharSequence
that best describes the given type,
possibly substituting the given ContactsContract.CommonDataKinds.CommonColumns.LABEL
value
for ContactsContract.CommonDataKinds.BaseTypes.TYPE_CUSTOM
.