你可以嘗試像...
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);
這可以讓你查詢content://sms
並只返回COLUMNS
你想要的,適合你的WHERE
標準,在ORDER
你描述下。 null
用於替換查詢中使用的?
(如Java的PreparedStatement
)。
更多信息:http://developer.android.com/reference/android/content/ContentResolver.html
爲什麼你不使用WHERE-clausel?就像「Select * From TableXY Where _id <5;」 – Prexx