Android and android Official Website

Source: Internet
Author: User

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 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.