You can do this by saving the data received through the web service to a SQLite database structured accordingly. If you want to get newer data than the last record in your database, you must save the key value in the SharedPreferences file. Example:
I would like to get all calendar events from a web service,
Today, the user was only viewing January events from the no event. 1 to the event number. 10 (the first time they are received through the web service, stored locally in the SQLite database, and then displayed using the cursor).
Tomorrow, as soon as the user downloads the application, the data already received will be downloaded from the SQLite database ("cache"), and the user will receive events that are newer than 10 through the web service; and repeat the process the day before (that is, save the received queries in SQLite DB, and then display them all from 1 to "x").
In this case, you save events 1-10 in the database, and you save “11” in your general preferences so that you know the starting point for your next batch of entities. Hope I managed to guide you.
Take a look at the storage options available on Android: http://developer.android.com/guide/topics/data/data-storage.html
All the best :)
source share