我從圖像下載代碼, http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html 令我困惑的是,他是怎麼得到的ImageView視圖從ImageDownloader下載()沒有返回值 回來?自定義列表視圖與ImageView的
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);
我明白了setImageBitmap和OnPostExexcute的觸發器。 imageView如何返回到調用函數。 難道是視圖作爲參考傳遞? – james