android - How to write a query instead of the keyword OR? -
the case 1 works well, case 2 don't work, there simple way instead of keyword or ?
case 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; }
case 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; }
try in case 2..
cursor cur = getcontentresolver().query(urismsuri, null,"_id in ('6','4') ", null, null);
see if works...
Comments
Post a Comment