- android ContentResolver 对数据库操作 in/not in的用法
List<String> threadIdList = new ArrayList<String>();
List<String> parameters = new ArrayList<String>();
Uri uri = MessageSQL.CONTENT_URI;
String[] projection = {new String("distinct "+MessageSQL.thread_id)};
String selection = MessageSQL.boxid+"= ?";
String[] selectionArgs1 = {String.valueOf(MessageSQL.MESSAGE_TYPE_FAILED)};
Cursor cursor = getContext().getContentResolver().query(uri, projection, selection, selectionArgs1, null);
while(cursor.moveToNext()){
int threadId = cursor.getInt(0);
threadIdList.add(String.valueOf(threadId));
parameters.add("?");
}
cursor.close();
Uri threadUri = QThread.THREAD_URI;
ContentResolver mContentResolver = getContext().getContentResolver();
ContentValues values = new ContentValues();
values.put(QThread.error, 0);
String where = QThread._ID+" not in ("+TextUtils.join(",", parameters)+")";
String[] selectionArgs2= threadIdList.toArray(new String[threadIdList.size()]);
mContentResolver.update(threadUri, values, where, selectionArgs2);
此处的解决方法是先获取参数,根据参数的个数设置“?”,
String where = QThread._ID+" not in ("+TextUtils.join(",", parameters)+")";
,然后在update方法中将
参数数组selectionArgs传入,效果相当于sql中的
select <YOUR SELECTIONS> from <YOUR TABLE NAME> where *** in/not in (arg1,arg2,....)
Speex 声学回声消除 jni wrapper
Speex echo cancellation configurationjava.lang.NoSuchMethodError: java.lang.System.arraycopy异常
可能是SDK版本的问题,要选择合适的SDK版本。