Android联系人中的多个查询

时间:2012-09-14 12:27:46

标签: android android-contacts

尝试使用Android联系人选择器获取NAME和NUMBER

Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
        String[] projection = new String[] { ContactsContract.Contacts._ID,
                ContactsContract.Contacts.DISPLAY_NAME,
                ContactsContract.CommonDataKinds.Phone.NUMBER };
        String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " = '"
                + ("1") + "'";
        String[] selectionArgs = null;
        String sortOrder = ContactsContract.Contacts.DISPLAY_NAME
                + " COLLATE LOCALIZED ASC";

但不幸的是我得到了:

android.database.sqlite.SQLiteException: no such column: has_phone_number: , while compiling: SELECT _id, display_name, data1 FROM view_data_restricted data WHERE (1 AND mimetype = 'vnd.android.cursor.item/phone_v2') AND (has_phone_number = '1') ORDER BY display_name COLLATE LOCALIZED ASC

0 个答案:

没有答案