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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -