本文整理匯總了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;
}
示例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);
}
示例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;
}
示例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();
}
示例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");
}