Hi,

I have a ListView, its rows each have an image downloaded from the net
in a separate thread.

When the image is done downloading, I notify my main thread, and need
to invalidate the corresponding row if it's on screen. I'm doing this:

 // run on the main thread.
 public void onThumbnailDownloaded(String url, Bitmap bmp) {
     for (int i = 0; i < mListView.getChildCount(); i++) {
         PanelMyRow panel = (PanelMyRow)mListView.getChildAt(i);
         if (panel.getUrl().equals(url)) {
             panel.getImageView().setImageBitmap(bmp);
             break;
         }
     }
 }

this seems to work ok. Ideally though, I think it'd be better if I
could somehow trigger my adapter to call its getView() method for this
'dirty' row. I can't find a method within ListView or BaseAdapter to
do this. Calling any of the invalidate methods has no effect, and any
of these:

  ListView.invalidateViews()
  BaseAdapter.notifyDatasetInvalidated();
  BaseAdapter.notifyDatasetChanged();

seem pretty heavyweight and my ListView scrolling will be very choppy
if the images are still downloading and one of the above three is
called during the callback. Is there some way I can simply mark the
child view as dirty which notifies the ListView that it should call
getView() on the adapter for that row again? Seems safer.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to