这个错误说明下标溢出,
例子:
Cursor cursor = getContentResolver().query(uri, new String[]{"contact_id"}, null, null, "contact_id desc limit 1"); //这有一行数据
f(cursor !=null && cursor.getCount()>0){
int contact_id = cursor.getInt(0); //此时选择还在-1行,这里出错误
}
改成:
f(cursor !=null && cursor.moveToFirst()){//直接指向第一行
int contact_id = cursor.getInt(0);
}