Could not get it wotking the update query for SMS database

104 views Asked by At

Below code is not working. If you see the output, it always return 0 no matter what I try ? Is there anything wrong OR API is deprecated or something ?

Please help

Code :

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+"");

Output :

COS:int  0
COS:int  0
COS:int  0
COS:int  0

Shouldn't it return the number of columns changed ?

0

There are 0 answers