我的应用程序有问题。一些代码,这会产生错误:
String selection = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
+ " like'%" + name + "%'";
String[] projection = new String[] { ContactsContract.CommonDataKinds.Phone.NUMBER };
Cursor c = context.getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection,
selection, null, null);
这是我的错误:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=4321, result=-1, data=Intent { (has extras) }} to activity
...
android.database.sqlite.SQLiteException: near "m": syntax error: , while compiling: SELECT data1 FROM view_data_restricted data WHERE (1 AND mimetype = 'vnd.android.cursor.item/phone_v2') AND (display_name like'%I'm in a pool%')
Caused by: android.database.sqlite.SQLiteException: near "m": syntax error: , while compiling: SELECT data1 FROM view_data_restricted data WHERE (1 AND mimetype = 'vnd.android.cursor.item/phone_v2') AND (display_name like'%I'm in a pool%')
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:158)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
at android.content.ContentProviderProxy.bulkQueryInternal(ContentProviderNative.java:330)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
at android.content.ContentResolver.query(ContentResolver.java:245)
Aneone 知道什么是错的吗?