您好我正在开发一个Android短信应用程序。我试图根据recepient_ids删除groupsms。例如,如果recepient_ids类似于12 13 14。
这是我正在尝试的代码
Uri uriSMSuri = Uri.parse("content://mms-sms/conversations?simple=true");
cursor = getContentResolver().query(uriSMSuri, new String[] {"*"}, null, null, "date desc");
while (cursor.moveToNext())
{
recipient_ids = cursor.getString(cursor.getColumnIndexOrThrow("recipient_ids"));
id = cursor.getString(cursor.getColumnIndexOrThrow("_id"));
String [] idArray = recipient_ids.split(" ");
if(idArray.length > 1)
{
Log.e("group sms"," ");
String uri = "content://mms-sms/conversations?simple=true" ;
int i = getContentResolver().delete(Uri.parse(uri), "recipient_ids ="+recipient_ids, null);
}
}
但是我的力量接近
java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.cursoradapter / com.example.cursoradapter.Sms}:android.database.sqlite.SQLiteException:near“13”:语法错误:,同时编译: SELECT _id FROM pdu WHERE recipient_ids = 12 13 14
不确定为什么它显示为SELECT _id FROM pdu in force close。请指导我解决这个问题。
谢谢!