How to write a query with a AND condition as part of ContentResolver query - Android Content Provider -


i have content resolver query translates select * book favflag = 1.

but want change translate select * book favflag = 1 , bookid = 2;

how achieve this?

here content resolver query:

cursor bookcursor = getactivity().getcontentresolver().query(     bookcontract.bookentry.content_uri,     null,     bookcontract.bookentry.columnfavflag + " = ?",     new string[]{"1"},     null); 

since there no bookcontract in android sdk aware of, assume own class. in case, not know api of class.

with in mind, try:

cursor bookcursor = getactivity().getcontentresolver().query(   bookcontract.bookentry.content_uri,   null,   bookcontract.bookentry.columnfavflag + " = ? , "+bookcontract.bookentry.columnid + " = ?",   new string[]{"1", "2"},   null); 

substitute in proper value bookcontract.bookentry.columnid.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -