Thanks Jason, sounds good. Are you extending BaseAdapter for your listview adapter? I thought it'd be a bit slow since every time getView () is called, I have to do the re-setting of my row's ImageView, but it's for the most part pretty smooth, just wondering how you find performance in your case?
Thanks On Nov 19, 5:07 pm, Jason Proctor <[email protected]> wrote: > i have almost the same situation as you, but the way i do it is a > little different -- > > when a list item view is made or recycled, it checks to see whether > its image is loaded or not. if it's not, it kicks off an AsyncTask > whose job it is to grab it using its URL. when that completes, it > calls the list item view back again and that in turn inflates the > bitmap and setImageBitmap() on the appropriate image view. > > have to keep track of the view being recycled while the task is > ongoing etc, but that awkwardness aside, this system seems to work ok. > > > > >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 > > -- > jason.vp.engineering.particle -- 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

