下面的代码不起作用。如果您看到输出,无论我尝试什么,它总是返回 0 ?有什么问题或 API 已被弃用或什么?
请帮忙
代码 :
public static final String ALL = "content://sms";
String where = "_id = 2";
ContentValues StatusValues = new ContentValues();
StatusValues.put(TextBasedSmsColumns.READ, 0);
int cursor = getContentResolver().update(Uri.parse(ALL), StatusValues, where, null);
Log.i("COS:int", cursor+"");
where = "_id = '2'";
cursor = getContentResolver().update(Uri.parse(ALL), StatusValues, where, null);
Log.i("COS:int", cursor+"");
where = "_id = ?";
cursor = getContentResolver().update(Uri.parse(ALL), StatusValues, where, new String[]{"2"});
Log.i("COS:int", cursor+"");
where = null;
cursor = getContentResolver().update(Uri.parse(ALL), StatusValues, where, null);
Log.i("COS:int", cursor+"");
输出 :
COS:int 0
COS:int 0
COS:int 0
COS:int 0
它不应该返回更改的列数吗?