本文整理匯總了Java中android.provider.ContactsContract.Data._ID屬性的典型用法代碼示例。如果您正苦於以下問題:Java Data._ID屬性的具體用法?Java Data._ID怎麽用?Java Data._ID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.provider.ContactsContract.Data
的用法示例。
在下文中一共展示了Data._ID屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEmailAdapterProjection
/**
* Get the NEW_PROJECTION for EmailAddressAdapter.
*/
public static String[] getEmailAdapterProjection() {
String[] emailAdapterProjection = {
Data._ID,
Data.DISPLAY_NAME,
Email.ADDRESS,
Data.MIMETYPE,
};
return emailAdapterProjection;
}
示例2: queryStep2
private void queryStep2(List<PhoneBean> beans, HashMap<Long, PhoneBean> phones) {
final String[] PROJ_DATA = new String[] {
Data._ID,
Data.CONTACT_ID,
Data.DATA1,
};
Cursor dataCursor = getContentResolver().query(Data.CONTENT_URI,
PROJ_DATA,
Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
null, DATA_QUERY_ORDER);
long dataId, contactId;
String number;
PhoneBean bean;
try {
dataCursor.moveToPosition(-1);
while(dataCursor.moveToNext()) {
dataId = dataCursor.getLong(0);
contactId = dataCursor.getLong(1);
number = dataCursor.getString(2);
bean = new PhoneBean(dataId, number);
beans.add(bean);
//same contactId save one phoneBean
phones.put(contactId, bean);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if(dataCursor != null) {
dataCursor.close();
}
}
}
示例3: queryStep1
private void queryStep1(HashMap<String, ArrayList<ContactBean>> contactsMap) {
final String[] PROJ_DATA = new String[] {
Data._ID,
Data.CONTACT_ID,
Data.DATA1,
Contacts.DISPLAY_NAME
};
Cursor dataCursor = getContentResolver().query(Data.CONTENT_URI,
PROJ_DATA,
Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'",
null, DATA_QUERY_ORDER);
long dataId, contactId;
String number, name;
PhoneBean phoneBean;
ContactBean contactBean;
ArrayList<ContactBean> tempSameBeans;
try {
dataCursor.moveToPosition(-1);
while(dataCursor.moveToNext()) {
dataId = dataCursor.getLong(0);
contactId = dataCursor.getLong(1);
number = dataCursor.getString(2);
name = dataCursor.getString(3);
phoneBean = new PhoneBean(dataId, number);
contactBean = new ContactBean(contactId, name);
contactBean.addNumber(phoneBean);
if(contactsMap.containsKey(name)) {
tempSameBeans = contactsMap.get(name);
if(!tempSameBeans.contains(contactBean)) {
tempSameBeans.add(contactBean);
}
} else {
tempSameBeans = new ArrayList<ContactBean>();
tempSameBeans.add(contactBean);
contactsMap.put(name, tempSameBeans);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if(dataCursor != null) {
dataCursor.close();
}
}
}