public static final String SPLIT_CHAR = "#";
private final String[] CONTACT_PROJECTION = new String[]{
ContactsContract.CommonDataKinds.Phone._ID, // 0
ContactsContract.CommonDataKinds.Phone.DATA, // 1
ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID, // 2
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
};
private final String SELECTION = ContactsContract.Data.MIMETYPE + " = ? ";
private final String[] SELECTION_ARGS = new String[]{
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE
};
關(guān)鍵查詢語句:
Cursor cursor = context.getContentResolver().query(ContactsContract.Data.CONTENT_URI, CONTACT_PROJECTION, SELECTION, SELECTION_ARGS, null);