jeudi 16 avril 2015

Is duplicating a good idea here and how? - ContentProvider

I am currently loading quite a lot of data from the ContentProvider at the start up of my application. Objects are built from these data andthen go through some filtering and grouping before being renderedto the user and of course depending on the size of data, the filtering takes up execution time and memory. These objects are kept in Application scope but problems arise when the app crashes and restarts or the app is killed by the system for over consumption of memory. I just don't feel good about this approachn because to be honest using a cursor (from the content resolver) is faster, less complicated and more dependable.


My current idea for a reimplementation is to keep an sqlite database that has tables which correspond to my filtering and grouping but this implies duplicating some rows of the ContentProvider on the device. Since the application has different contexts displaying a listview, then using an SQLiteCursor would be the logical thing.



Is this approach reasonable or/and practical? I may end up doing as described above but if that's the case, how do I keep my duplicate database synchronized with the ContentProvider? Probably with some lsiteners and a service.



I don't want to rely on updating the database everytime the app is started because that will only take be back to what I was running from.


Aucun commentaire:

Enregistrer un commentaire