代わりにDownloadedDrawable
クラスを拡張してから、適切なスーパーコンストラクターの1つを選択して、デフォルトの画像ビットマップを指定することをお勧めします。BitmapDrawable
Drawable
/**
* A fake Drawable that will be attached to the imageView while the download is in progress.
*
* Contains a reference to the actual download task, so that a download task can be stopped
* if a new binding is required, and makes sure that only the last started download process can
* bind its result, independently of the download finish order.</p>
*/
private static class DownloadedDrawable extends BitmapDrawable {
private final WeakReference<BitmapDownloaderTask>
bitmapDownloaderTaskReference;
private DownloadedDrawable(BitmapDownloaderTask bitmapDownloaderTask,
Resources resources, Bitmap bitmap) {
super(resources, bitmap); // you'll have to provide these
bitmapDownloaderTaskReference =
new WeakReference<BitmapDownloaderTask>(bitmapDownloaderTask);
}
public BitmapDownloaderTask getBitmapDownloaderTask() {
return bitmapDownloaderTaskReference.get();
}
}