samedi 28 mars 2015

Android ContentProvider URI, defining URI (UriMatcher) for Date/Time related requests

Assume that I am storing in sqlite database items (rows) which have defined column: TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL and I would like to retrieve subset of rows that meets following conditions: 1) all rows in given day like http://contentauthorities/base_path/in_day/{this_date} 2) all rows in given week like http://contentauthorities/base_path/in_week/{this_date} 3) all rows in given month like http://contentauthorities/base_path/in_month/{this_date} 4) all rows newer than http://contentauthorities/base_path/from_date/{this_date} 5) all rows between dates http://contentauthorities/base_path/from_date/{this_date1}/to_date/{this_date2}


Should i use here Date -> long (UNIX time) conversion and next some to string conversion and then to long again in ContentProvider to build selection query?


Aucun commentaire:

Enregistrer un commentaire