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