1

I am using a listview and in the every row of that listview i am showing some images which is downloaded from URL, but the problem is that whenever i scroll up or down the images get vanished and again downloaded from the URL. How can i overcome this problem ? Can i use cache memory ? If yes, then please give me a easy sample code if possible.

zaiff
  • 999
  • 2
  • 13
  • 29

2 Answers2

1

ya you can store image in cache by using the mechanism of Lazy LIST

Community
  • 1
  • 1
Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115
0

Although, the nature of listview is not like as you are describing. Anyhow you can store the downloaded images in an ArrayList and check before download whether the particular image exists in the ArrayList. If it is, then there is no need to redownload it. Just pick the particular image and load it into listview item.

Khawar Raza
  • 15,870
  • 24
  • 70
  • 127
  • actually i am loading the images into listview, now i want to save the image into cache. i am using asynctask to load the images from the URL in the list view. now when the images get load into the listview and i scroll up or down the images are disappearing and again started getting downloaded from URL and it takes time, but i want to save those images into cache so that it does not take that much time to again load. – zaiff Sep 15 '11 at 09:30