Android how to efficiently implement data caching and configuration change events in fragments?

494 views Asked by At

I'm confused in finding a better way to implement:

1) data caching, as I am fetching data from rest APIs by executing AsyncTask in every fragment say 3-4 times, what I want is to reload the data from cache instead of calling the AsyncTask again.

2) a way to deal with configuration changes events... such as orientation change or some other events.

confusion: are DATA Caching and onconfiguration changes related at all somehow? If so, does only caching code can serve the purpose for both issues?

What I've tried : here's a project that does the magic for onconfiguration changes part and this library project can serve the data caching purpose

or should i use the volley library as recommended in google io 2013?

My MODEL: I am having 1 ACTIVITY that controls and seven other specific fragments that does the execution part. Please type your words if you've any kind of idea how to proceed?

1

There are 1 answers

0
a.ch. On

Loaders may totally satisfy your needs. If not, consider using LruCache.