android - How to put a query using cursor loader? -


this sqlite query , need use in cursor loader. select * triphistory _startdate > date('now','-8 days');

i try not working code given below . please check this.

        c = new cursorloader(                 this,                 hollacontractclass.hollas.trip_history_uri,                 projection,                 hollacontractclass.hollas.hollatriphistorycolumns.status                         + " =? , "                         + hollacontractclass.hollas.hollatriphistorycolumns.start_date                         + " >?",                 new string[] { "finished", "date('now','-8 days')" },                 hollacontractclass.hollas.hollatriphistorycolumns.start_date                         + " asc"); 

but return 0 .. in advance

sql parameters (?) strings not interpreted in way.

the values in start date column compared against literal string date('now','-8 days').

to execute date function, have write directly sql string:

c = new cursorloader(         ...                 + hollacontractclass.hollas.hollatriphistorycolumns.start_date                 + " > date('now','-8 days')",         new string[] { "finished", }, 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -