如何在没有SIM卡联系的情况下获取联系人列表?
到目前为止,我的光标看起来像这样
public final static Uri CONTENT = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
public final static String ID = ContactsContract.CommonDataKinds.Phone.CONTACT_ID;
public final static String NAME = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME;
public final static String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER;
public final static String PHOTO_URI = ContactsContract.CommonDataKinds.Photo.PHOTO_URI;
public final static String STARRED = ContactsContract.CommonDataKinds.Phone.STARRED;
String mSelectionClause = NAME + " IS NULL";
mOrderBy = NAME + " COLLATE LOCALIZED ASC";
Cursor cursor = getActivity().getContentResolver().query(CONTENT, null, mSelectionClause, null, mOrderBy);
我应该添加什么来查询以从结果中删除sim联系人?
答案 0 :(得分:1)
我在
找到了解决方案android showing both sim and phone contacts
刚刚添加
private final String excludeSim = ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'com.android.contacts.sim' AND "
+ ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'com.anddroid.contacts.sim' AND " // HTC
+ ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'vnd.sec.contact.sim' AND "
+ ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'USIM Account' ";
...
String mSelectionClause = NAME + " IS NULL AND " + excludeSim;