Android and android Official Website
Inside AfinalFinalBitmap: used to display bitmap images without considering thread concurrency and oom.
1. Test the request
Open http://avatar.csdn.net/C/6/8/1_bz419927089.jpg with web page "to see an image.
2. Create a FinalBitmap object
FinalBitmap bitmap = FinalBitmap. create (this );
3. Set the uri address of the image
String uri = "http://avatar.csdn.net/C/6/8/1_bz419927089.jpg ";
4. load images
Private ImageView iv;
Iv = (ImageView) findViewById (R. id. imageView );
// Initialize the image displayed during loading
Bitmap loadingBitmap = BitmapFactory. decodeResource (getResources (), R. drawable. snapshotmg);/* R. drawable. snapshotmg indicates the default image display */
// Initialize the image that failed to be loaded
Bitmap failBitmap = BitmapFactory. decodeResource (getResources (), R. drawable. snapshotmg );
// Method 1: image is the control for displaying the image
Bitmap. display (iv, uri );
// Method 2: loadingBitmap indicates the image that is being loaded.
// Bitmap. display (iv, uri, loadingBitmap );
// Method 3: loadingBitmap indicates the loading image, and failBitmap indicates the loading failure image.
// Bitmap. display (iv, uri, loadingBitmap, failBitmap );
// Method 4: You can set the size of the loaded image.
// Bitmap. display (iv, uri, 100,100 );
// Method 5: set the size of the image to be loaded and the image to be loaded or failed to be loaded
// Bitmap. display (iv, uri, 100,100, loadingBitmap, failBitmap );