I have following scenario:

* I develop an Android Application which has a ListView in the MainActivity
* The data for populating the ListView comes from a URL returning JSON data
* I want to "cache" the ListView items as long as possible (depending on the cache control header of the URL resource), which means that I do not want to reload the ListView data (from the external URL) each time the user goes back to the MainActivity

I found this article: [Android AsyncTask ListView - JSON|Surviving w/ Android](http://www.survivingwithandroid.com/2013/01/android-async-listview-jee-and-restful.html) which is good, but not excatly what I want. I do not want to execute the AsyncTask each time the user comes back to the MainActivity.

I thought of storing the ListView items in a globally available parameter of the Application. This parameter would then be some sort of custom container which holds the ListItems and the timestamp at which they expire. Then it would be possible to check in the "doInBackground" method of the AsyncTask if the ListView items are valid. If yes they are returned, if not they are loaded from URL and saved to the global variables.

My question: Does this solution make sense? How would you solve this? Any ideas on making this better?