public void run ( ) { // TODO: if we had a way to check for in-memory hits, we could improve performance by // fetching an image from the in-memory cache on the main thread Bitmap bitmap = imageCache . getBitmap ( imageUrl ) ; if ( bitmap == null ) { bitmap = downloadImage ( ) ; } // TODO: gracefully handle this case. notifyImageLoaded ( imageUrl , bitmap ) ; }
The job method run on a worker thread . It will first query the image cache and on a miss download the image from the Web .