The use of frame Imageloader for Android picture cache

Source: Internet
Author: User

Displayimageoptions options; //Displayimageoptions is the class for setting up picture display

Create displayimageoptions using Displayimageoptions.builder ()
options = new Displayimageoptions.builder ()
. Showstubimage (R.drawable.ic_stub)//Set picture to display during picture download
. Showimageforemptyuri (R.drawable.ic_empty)//Set picture to display when the image URI is empty or wrong
. Showimageonfail (R.drawable.ic_error)//Set Picture of error display during picture loading or decoding
. Cacheinmemory (TRUE)//Set whether the downloaded picture is slow to exist in memory
. Cacheondisc (TRUE)//Set whether the downloaded picture is slow to exist on the SD card
. Displayer (New Roundedbitmapdisplayer (20))//Set rounded picture
. build (); To create a configured Displayimageoption object

Private Imageloadinglistener Animatefirstlistener = new Animatefirstdisplaylistener ();

/**
* Image loading first time display listener
* @author Administrator
*
*/
private static class Animatefirstdisplaylistener extends Simpleimageloadinglistener {

Static final list<string> displayedimages = collections.synchronizedlist (New linkedlist<string> ());
@Override
public void Onloadingcomplete (String imageuri, view view, Bitmap loadedimage) {
if (loadedimage! = null) {
ImageView ImageView = (ImageView) view;
Whether to display the first time
Boolean firstdisplay =!displayedimages.contains (Imageuri);
if (Firstdisplay) {
Picture fade-in effect
Fadeinbitmapdisplayer.animate (ImageView, 500);
Displayedimages.add (Imageuri);
}
}
}
}

/**
* Show Pictures
* Parameter 1: Image URL
* Parameter 2: control to display pictures
* Parameter 3: Display the picture's settings
* Parameter 4: Listener
*/
Imageloader.displayimage (Imageurls[position], holder.image, Options, Animatefirstlistener);

For more information, refer to the blog:

http://blog.csdn.net/wwj_748/article/details/10079311

The use of frame Imageloader for Android picture cache

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.