Android---afianl frame inside the finalbitmap load network picture

Source: Internet
Author: User

afinal inside Finalbitmap: Used to display bitmap pictures without regard to issues such as thread concurrency and oom.

1. Test request

Use the Web page to open http://avatar.csdn.net/C/6/8/1_bz419927089.jpg "to see a picture.

2. New Finalbitmap Object

Finalbitmap bitmap = Finalbitmap.create (this);

3. Set the URI address of the picture

String uri = "Http://avatar.csdn.net/C/6/8/1_bz419927089.jpg";

4. Loading pictures

Private ImageView IV;

iv= (ImageView) Findviewbyid (R.id.imageview);

The picture that is displayed when the load is initialized

  Bitmap Loadingbitmap = Bitmapfactory.decoderesource (Getresources (), R.DRAWABLE.SNAPSHOTMG);/* R.DRAWABLE.SNAPSHOTMG display the picture by default */

Initialize load failed to display picture

Bitmap Failbitmap = Bitmapfactory.decoderesource (Getresources (), R.DRAWABLE.SNAPSHOTMG);


The first way: image is the control for which you want to display a picture
Bitmap.display (iv, URI);
Second way: Loadingbitmap is the picture that is displayed when loading
Bitmap.display (iv, Uri, LOADINGBITMAP);
The third Way: Loadingbitmap for loading pictures, Failbitmap for loading failed pictures
Bitmap.display (iv, URI, Loadingbitmap, Failbitmap);
Fourth Way: We can also set the size of the loaded picture
Bitmap.display (iv, URI, 100, 100);
Fifth way: Set the size of the loaded picture and the picture that failed to load and load
Bitmap.display (iv, URI, +, +, Loadingbitmap, failbitmap);

Android---afianl frame inside the finalbitmap load network picture

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.