I am working on an android application, This app fetches data from an web service which is in XML which i parse and store in form of an Data Object now this data includes image Url which i retrieve while displaying it in a list.But due to network look ups the scrolling has become sluggish.Now my question is
1)Should i persist this retrieved data including the images to avoid multiple network look ups say like store data retrieved into sharedPreferences or database and then load it from here into ListView
2)Use lazy loading for list and persist data via softReferences
Worry in case 2 is that the data might get Garbage collected early
3)What is the best architecture for this app??
Also the application retrieves 3 distinct Data Sets where two of them need the first one's data to process their request, Any help in this regard will be mighty useful
Loading images like this is a problem on all types of devices. What needs to be done, is the retrieval of the images themselves needs to run on a separate thread asynchronously. Which means in a separate thread. When the image is loaded, that thread then populates the UI with the image. You can also do some caching after the image is loaded, so that you can start your new thread, look in the cache to see if the image is already there, if not then go get the image. When the image is loaded, put it in to the Cache, and then put the image on the UI.
I believe there is a library already out there for doing this, I think I had found one a while ago, but I can't remember, wait found it, it is called Square Wolf Android Image Cache.
I use one just like it on my iPhone apps that use images in a Table.