本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Email.ADDRESS属性的典型用法代码示例。如果您正苦于以下问题:Java Email.ADDRESS属性的具体用法?Java Email.ADDRESS怎么用?Java Email.ADDRESS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.ContactsContract.CommonDataKinds.Email
的用法示例。
在下文中一共展示了Email.ADDRESS属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillContactDataFromNameAndEmail
private boolean fillContactDataFromNameAndEmail(String query, List<Recipient> recipients,
Map<String, Recipient> recipientMap) {
query = "%" + query + "%";
Uri queryUri = Email.CONTENT_URI;
String selection = Contacts.DISPLAY_NAME_PRIMARY + " LIKE ? " +
" OR (" + Email.ADDRESS + " LIKE ? AND " + Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "')";
String[] selectionArgs = { query, query };
Cursor cursor = contentResolver.query(queryUri, PROJECTION, selection, selectionArgs, SORT_ORDER);
if (cursor == null) {
return false;
}
fillContactDataFromCursor(cursor, recipients, recipientMap);
return true;
}
示例2: fillContactDataFromQuery
private void fillContactDataFromQuery(String query, List<Recipient> recipients,
Map<String, Recipient> recipientMap) {
ContentResolver contentResolver = getContext().getContentResolver();
query = "%" + query + "%";
Uri queryUri = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
String selection = Contacts.DISPLAY_NAME_PRIMARY + " LIKE ? " +
" OR (" + Email.ADDRESS + " LIKE ? AND " + Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "')";
String[] selectionArgs = { query, query };
Cursor cursor = contentResolver.query(queryUri, PROJECTION, selection, selectionArgs, SORT_ORDER);
if (cursor == null) {
return;
}
fillContactDataFromCursor(cursor, recipients, recipientMap);
if (observerContact != null) {
observerContact = new ForceLoadContentObserver();
contentResolver.registerContentObserver(queryUri, false, observerContact);
}
}
示例3: getDataProjection
/**
* Get the DATA_PROJECTION for ContactPicker and PhoneNumberPicker.
*/
public static String[] getDataProjection() {
String[] dataProjection = {
Data.MIMETYPE,
Email.ADDRESS,
Email.TYPE,
Phone.NUMBER,
Phone.TYPE,
};
return dataProjection;
}
示例4: getEmailAdapterProjection
/**
* Get the NEW_PROJECTION for EmailAddressAdapter.
*/
public static String[] getEmailAdapterProjection() {
String[] emailAdapterProjection = {
Data._ID,
Data.DISPLAY_NAME,
Email.ADDRESS,
Data.MIMETYPE,
};
return emailAdapterProjection;
}
示例5: getEmailAddress
/**
* Get Email.ADDRESS for EmailAddressAdapter.
*/
public static String getEmailAddress() {
return Email.ADDRESS;
}
示例6: getMails
private List<DbContactEmailSensor> getMails(DbContactSensor sensorContact,
ContentProviderClient finalEmailsContentClient) {
if (finalEmailsContentClient == null) {
Log.d(TAG, "finalEmailsContentClient is NULL");
return Collections.emptyList();
}
long deviceId = PreferenceProvider.getInstance(context).getCurrentDeviceId();
long longContactId = sensorContact.getContactId();
Map<String, DbContactEmailSensor> mapExistingMails = getExistingMails(longContactId);
String[] columns = {
Email.ADDRESS,
Email.TYPE
};
Cursor emailsCursor = null;
try {
emailsCursor = finalEmailsContentClient
.query(URI_EMAIL,
columns,
Email.CONTACT_ID + " = " + longContactId,
null,
null);
if (emailsCursor == null || emailsCursor.getCount() <= 0) {
return Collections.emptyList();
}
String created = DateUtils.dateToISO8601String(new Date(), Locale.getDefault());
List<DbContactEmailSensor> entriesToInsert = new ArrayList<>(emailsCursor.getCount());
while (emailsCursor.moveToNext()) {
DbContactEmailSensor sensorContactMail = new DbContactEmailSensor();
sensorContactMail.setMailId(getLongByColumnName(emailsCursor, Email._ID));
sensorContactMail.setContactId(sensorContact.getId());
sensorContactMail.setAddress(getStringByColumnName(emailsCursor, Email.ADDRESS));
sensorContactMail.setType(getStringByColumnName(emailsCursor, Email.TYPE));
sensorContactMail.setIsNew(Boolean.TRUE);
sensorContactMail.setIsDeleted(Boolean.FALSE);
sensorContactMail.setIsUpdated(Boolean.TRUE);
sensorContactMail.setCreated(created);
sensorContactMail.setDeviceId(deviceId);
if (checkForContactMailChange(mapExistingMails, sensorContactMail)) {
entriesToInsert.add(sensorContactMail);
}
}
// remaining mails are deleted
deleteRemainingEmailEntries(mapExistingMails, false);
return entriesToInsert;
} catch (Exception e) {
Log.e(TAG, "Some error in getMails");
} finally {
if (emailsCursor != null) {
emailsCursor.close();
}
}
return Collections.emptyList();
}