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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -