当我尝试过滤autocompleteTextView的名称时出错。我不知道出了什么问题。出现的警告是
android.database.sqlite.SQLiteException:near“mimetype”:语法错误:,同时编译:SELECT display_name,_id FROM view_data_restricted data WHERE(1)AND(data1 =?mimetype ='vnd.android.cursor .item / group_membership'AND display_name like'%rui%')ORDER BY display_name
这是我的代码:
cursorContactosGrupos = getContentResolver().query(ContactsContract.Data.CONTENT_URI,
new String[]{ContactsContract.CommonDataKinds.GroupMembership.DISPLAY_NAME, ContactsContract.CommonDataKinds.GroupMembership._ID},
ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID + " =? " + Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE + "' AND " + ContactsContract.CommonDataKinds.GroupMembership.DISPLAY_NAME + " like '%" + filter + "%'" ,
new String[]{String.valueOf(tempCurs.getLong(0))},
ContactsContract.CommonDataKinds.GroupMembership.DISPLAY_NAME
);
有人可以帮帮我吗?感谢
答案 0 :(得分:0)
在MIME类型参数之前,您似乎需要另一个AND
。
答案 1 :(得分:0)
mimetype之前没有AND
。