File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes Help with Android Application Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Help with Android Application Design" Watch "Help with Android Application Design" New topic

Help with Android Application Design

zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 154

Hello Guys,

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

Thanks & Regards
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 154

Hey Mark thanks a ton man, I was thinking of doing it the say you suggested because repeated Network look ups will most definitely be costly. Will definitely check out the library you suggested
I agree. Here's the link:
subject: Help with Android Application Design
It's not a secret anymore!