0

I am using a GridView having image as child items.

The getView functions loads a default image from the application "Loading.gif" for all the child items. In another thread I load all the images to some Bitmap type into the adapter.

Is it wise enough to call adapter.notifyDataSetChanged() after each image is loaded ?

Or is there and alternative way to directly update the image ?

Gaurav Shah
  • 5,223
  • 7
  • 43
  • 71

1 Answers1

1

Checkout the technique used in ListView , where default image used in listview items. And a thread load images for list items and update the new images without adapter.notifyDataSetChanged() called.

http://iamvijayakumar.blogspot.com/2011/06/android-lazy-image-loader-example.html

If you want more efficient way to do this then check this out.

http://developer.android.com/resources/samples/XmlAdapters/src/com/example/android/xmladapters/ImageDownloader.html

Arslan Anwar
  • 18,746
  • 19
  • 76
  • 105
  • But what if its like my current view show 4 images . the list has 100 image. And when one image is loaded I call notifiyDataSetChanged() it would load the view for 4 images . ? efficiency ... – Gaurav Shah Nov 11 '11 at 10:49