Imageloader Configuration (Note)

Source: Internet
Author: User

/** * Config Imageloader */private void Configimageloader () {File Disccachedir = Storageutils.getowncachedi        Rectory (Getapplicationcontext (), "/iworker/cache/images");        int memclass = ((Android.app.ActivityManager) Getsystemservice (Context.activity_service)). Getmemoryclass (); Memclass = memclass > 32?        32:memclass;        Use 1/8 of the available memory as the picture cache LOGGER.D ("Memory Memclass size:{%s}", Memclass);        Final int cacheSize = 1024x768 * 1024x768 * MEMCLASS/4;        LOGGER.D ("Memory Cache size:{%s}", cacheSize); imageloaderconfiguration config = new Imageloaderconfiguration.builder (Getapplicationcontext ()). MemoryCach                        Eextraoptions (+). Taskexecutor (Executors.newfixedthreadpool (10))//Open 10 threads download picture, default is 3                        Sets the maximum width of each file in the cache, by default, the screen width is high//. Diskcacheextraoptions (at a minimum, and null) The maximum width//. Diskcacheextraoptions (240, 24) stored on the SD card0, NULL)///. ThreadPoolSize (3)//Set thread pool size, default is 3//. de Nycacheimagemultiplesizesinmemory ()//disable caching of multiple images of different sizes//. ThreadPriority (thre Ad. NORM_PRIORITY-1)//thread priority, default//. Tasksprocessingorder (Queueprocessingtype.                        FIFO)//. Taskexecutor (Executor). MemoryCache (New Lrumemorycache (cacheSize))                        Cache policy//default is set to 1/8//. Memorycachesize (CacheSize) . Memorycachesizepercentage (13)//Set maximum memory cache size. DiskCache (New Unlimiteddisccache (Disccachedir) )//hard disk cache policy: This cache class does not have any restrictions//sets disk cache for//IM                        Ages. Default is Android/data/[app_package_name]/cache//. Diskcachesize (* 1024x768 * 1024x768)//50m . DISKCAChefilecount ($)//sets maximum file count in Disk//cache directory. Set maximum number of files                        . Diskcachefilenamegenerator (New//Hashcodefilenamegenerator ())//Encrypt the URI name at the time of saving with Hashcode . Imagedownloader (New Iworkerimagedownloader (This))//. Defaultdisplayimageopti                ONS (Displayimageoptions.createsimple ()). Writedebuglogs ()//Output debug information, release the version of the time, do not need this sentence        . build ();    Imageloader.getinstance (). init (config); }
Typically configured in the custom application.



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Imageloader Configuration (Note)

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.