Can you try something like…
private static final Uri SMS_URI = Uri.parse("content://sms");
private static final String[] COLUMNS = new String[] {"date", "address", "body", "type"};
private static final String WHERE = "type = 2";
private static final String ORDER = "date DESC";
// ...
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(SMS_URI, COLUMNS, WHERE + " AND date > " +
timeLastChecked, null, ORDER);
This lets you query content://sms
and return only the COLUMNS
you want, that fit your WHERE
criteria, at the ORDER
you decribed. The null
is used to replace the ?
you used in the query (like Java’s PreparedStatement
).
More info: http://developer.android.com/reference/android/content/ContentResolver.html
0
solved How to filter data before get it out from the database? [closed]