Search code examples
androidlistviewandroid-asynctasklazy-loadinglistadapter

Lazy Loading (Image + Text) for Linear Layouts


I am trying to implement an activity shown in the image(Wireframe) uploaded(). There could be n number of such items.(Lazy Loading is expected to be implemented.) Images are ImageButtons and QTY(quantity) are spinners. Item name, item price and item images are fetched from server.

I expect a different implementation when I click on Item Image and When I click on qunatity spinner. This is not possible when I implement this using listview + adapter. (I have followed http://wptrafficanalyzer.in/blog/android-lazy-loading-images-and-text-in-listview-from-http-json-data/)

I expect the images will be loaded in a different thread.

Could anyone please give me a direction on how to go about this? I have read enough implementations using listview + adapters. None of them help solve the problem Expected wireframe design


Solution

  • Lars has a great tutorial on ListViews and using custom adapters to populate them here. The section titled "ListViews and performance" should be the most helpful.

    For the lazy loading, check out Universal Image Loader. All you have to do is initialize the image loader in your application class and then call ImageLoader.getInstance() anywhere you need to use it. Using .displayImage() takes an image uri and an ImageView. All the threading and bitmap decoding is done by the library. It makes it absurdly easy and has tons of extra features.