/** * 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)