当前位置: 首页>>代码示例>>Java>>正文


Java Email.ADDRESS属性代码示例

本文整理汇总了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;

}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:20,代码来源:RecipientLoader.java

示例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);
    }
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:23,代码来源:RecipientLoader.java

示例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;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:13,代码来源:HoneycombMR1Util.java

示例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;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:12,代码来源:HoneycombMR1Util.java

示例5: getEmailAddress

/**
 * Get Email.ADDRESS for EmailAddressAdapter.
 */
public static String getEmailAddress() {
  return Email.ADDRESS;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:6,代码来源:HoneycombMR1Util.java

示例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();
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:70,代码来源:ContactsSensor.java


注:本文中的android.provider.ContactsContract.CommonDataKinds.Email.ADDRESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。