案例 1 效果很好,但案例 2 不起作用,有没有简单的方法来代替关键字 OR ?
情况1
public List<String> getSMS(int pos) {
List<String> sms = new ArrayList<String>();
Uri uriSMSURI = Uri.parse(valueList.get(pos));
Cursor cur = getContentResolver().query(uriSMSURI, null,"_id= '6' or _id= '4' ", null,
null);
while (cur.moveToNext()) {
String address = cur.getString(cur.getColumnIndex("address"));
String body = cur.getString(cur.getColumnIndexOrThrow("body"));
sms.add("Number: " + address + " .Message: " + body+" CW "+cur.getString(cur.getColumnIndex("_id")) );
}
return sms;
}
案例2
public List<String> getSMS(int pos) {
List<String> sms = new ArrayList<String>();
Uri uriSMSURI = Uri.parse(valueList.get(pos));
Cursor cur = getContentResolver().query(uriSMSURI, null,"_id in ['6','4'] ", null,
null);
while (cur.moveToNext()) {
String address = cur.getString(cur.getColumnIndex("address"));
String body = cur.getString(cur.getColumnIndexOrThrow("body"));
sms.add("Number: " + address + " .Message: " + body+" CW "+cur.getString(cur.getColumnIndex("_id")) );
}
return sms;
}