當前位置: 首頁>>代碼示例>>Java>>正文


Java Contacts._ID屬性代碼示例

本文整理匯總了Java中android.provider.ContactsContract.Contacts._ID屬性的典型用法代碼示例。如果您正苦於以下問題:Java Contacts._ID屬性的具體用法?Java Contacts._ID怎麽用?Java Contacts._ID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.provider.ContactsContract.Contacts的用法示例。


在下文中一共展示了Contacts._ID屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAllContactsEmailAddressesInfo

@Override
public AddressBookEmailBuilder getAllContactsEmailAddressesInfo(Activity activity) {
    String[] PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Email.DATA }; 
    Cursor c = activity.managedQuery(Email.CONTENT_URI, PROJECTION, null, null, null);

    // We give a list of emails: [email protected],[email protected],[email protected]
    // We get back only a list of emails of users that exist on the system ([email protected])
    // Iterate over all those returned users, on each iteration, remove from our hashmap.
    // Can now use the left over hashmap, which is still in correct order to display invites.
    AddressBookEmailBuilder bld = new AddressBookEmailBuilder();
    if (c.moveToFirst()) {
        bld.addContact(c.getString(1), c.getString(2));
        while (c.moveToNext()) {
            bld.addContact(c.getString(1), c.getString(2));
        }
    }
    c.close();
    
    return bld;
}
 
開發者ID:Kamshak,項目名稱:foursquared,代碼行數:20,代碼來源:AddressBookUtils5.java

示例2: asyncQueryDisplayName

private void asyncQueryDisplayName(final Uri lookupUri)
{
    final String DISPLAY_NAME_COL = Build.VERSION.SDK_INT
          >= Build.VERSION_CODES.HONEYCOMB ?
          Contacts.DISPLAY_NAME_PRIMARY :
          Contacts.DISPLAY_NAME;

    final String[] projection = new String[] {
          Contacts._ID,
          DISPLAY_NAME_COL,
    };

    NotifyingAsyncQueryHandler asyncQuery = new NotifyingAsyncQueryHandler(this, this);
    asyncQuery.startQuery(1, lookupUri,
        lookupUri,
        projection,
        null,
        null,
        null);
}
 
開發者ID:bdiegel,項目名稱:android-giftwise,代碼行數:20,代碼來源:MainActivity.java

示例3: getContactsByGroup

@Override
public Cursor getContactsByGroup(Context ctxt, String groupName) {

    if (TextUtils.isEmpty(groupName)) {
        return null;
    }

    String[] projection;
    if (Compatibility.isCompatible(11)) {
        projection = new String[] {
                Contacts._ID,
                Contacts.DISPLAY_NAME,
                Contacts.PHOTO_ID,
                Contacts.CONTACT_STATUS_ICON,
                Contacts.CONTACT_STATUS,
                Contacts.CONTACT_PRESENCE,
                Contacts.PHOTO_URI
        };
    } else {
        projection = new String[] {
                Contacts._ID,
                Contacts.DISPLAY_NAME,
                Contacts.PHOTO_ID,
                Contacts.CONTACT_STATUS,
                Contacts.CONTACT_PRESENCE
        };
    }

    Uri searchUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, Uri.encode(groupName));
    
    
    Cursor c = null;
    try {
        c = ctxt.getContentResolver().query(searchUri, projection, null, null,
                Contacts.DISPLAY_NAME + " ASC");
    } catch(Exception e) {
        Log.e(THIS_FILE, "Error while retrieving group", e);
    }
    return c;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:40,代碼來源:ContactsUtils5.java

示例4: getAllContactsPhoneNumbers

@Override
public String getAllContactsPhoneNumbers(Activity activity) {
    StringBuilder sb = new StringBuilder(1024); 
    String[] PROJECTION = new String[] { Contacts._ID, Phone.NUMBER };
    Cursor c = activity.managedQuery(Phone.CONTENT_URI, PROJECTION, null, null, null); 
    if (c.moveToFirst()) { 
        sb.append(c.getString(1));
        while (c.moveToNext()) { 
            sb.append(",");
            sb.append(c.getString(1));
        } 
    }
    return sb.toString();
}
 
開發者ID:Kamshak,項目名稱:foursquared,代碼行數:14,代碼來源:AddressBookUtils5.java

示例5: onCreateLoader

/**
 * This hook method is called back by the LoaderManager when the
 * LoaderManager is initialized.
 */
public Loader<Cursor> onCreateLoader(int id, 
                                     Bundle args) {
    // Columns to query.
    final String columnsToQuery[] =
        new String[] {
        ContactsContract.Contacts._ID,
        ContactsContract.Contacts.DISPLAY_NAME,
        ContactsContract.Contacts.STARRED 
    };
	
    // Contacts to select.
    final String selection =
        "((" 
        + Contacts.DISPLAY_NAME 
        + " NOTNULL) AND ("
        + Contacts.DISPLAY_NAME 
        + " != '' ) AND (" 
        + Contacts.STARRED
        + "== 1))";

    // Create a new CursorLoader that will perform the query
    // asynchronously.
    return new CursorLoader(mOps.getActivityContext(),
                            ContactsContract.Contacts.CONTENT_URI,
                            columnsToQuery,
                            selection,
                            null,
                            Contacts._ID 
                            + " ASC");
}
 
開發者ID:juleswhite,項目名稱:mobilecloud-15,代碼行數:34,代碼來源:QueryContactsCommand.java


注:本文中的android.provider.ContactsContract.Contacts._ID屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。