I got image download code from, http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html what puzzled me is how he got the imageview's view back from the download() without return value from ImageDownloader?
public class ImageAdapter extends BaseAdapter {
...
public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
view = new ImageView(parent.getContext());
view.setPadding(6, 6, 6, 6);
}
imageDownloader.download(URLS[position], (ImageView) view);
return view;
}
..
public class ImageDownloader {
...
private void forceDownload(String url, ImageView imageView) {
....
case CORRECT:
task = new BitmapDownloaderTask(imageView);
DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
imageView.setImageDrawable(downloadedDrawable);
imageView.setMinimumHeight(156);
task.execute(url);