CARVIEW |
Select Language
HTTP/2 200
date: Wed, 23 Jul 2025 23:40:50 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"26c80eca5d5dc28d6f2694bf2c53b775"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=PepQeWRVtGIA6tAh4%2BJJ%2FfHAaEtLVh7Gdbt1Nm6DnryoqdkZAzqvMlgVK%2F2EhcMU4oSkjYwTxU5y6GCl%2FeFWtrFpVFX3PIHIEPNsXErxbgJu0xdYMxRxSw3q1W7JU9wbnGQWFxAeNGoubRFqAz%2FPy7EzCunFsgKAMLE4%2Flmn8GtEVoNzfzePsN8jlIeHKvck6YunTQoKhTxcS3tVRqZuAlIZS0C%2B6w062AAH8%2FnVQIgc2CG62URXpKX0mpCYge%2BiYgc26O3s078Wie3l80XZxQ%3D%3D--smn6A5zuVSh9ud6u--wqxf160NfmKCCosD6id%2Ftw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.204319255.1753314050; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 23:40:50 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 23:40:50 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: E7E2:26221E:115DC6C:14E1EC9:68817302
Useful Info · nostra13/Android-Universal-Image-Loader Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Useful Info
Mehdi Achour edited this page Aug 2, 2015
·
4 revisions
- Caching is NOT enabled by default. If you want loaded images to be cached in memory and/or on disk then you should enable caching in DisplayImageOptions this way:
// Create default options which will be used for every
// displayImage(...) call if no options will be passed to this method
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
...
.cacheInMemory(true)
.cacheOnDisk(true)
...
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
...
.defaultDisplayImageOptions(defaultOptions)
...
.build();
ImageLoader.getInstance().init(config); // Do it on Application start
// Then later, when you want to display image
ImageLoader.getInstance().displayImage(imageUrl, imageView); // Default options will be used
or this way:
DisplayImageOptions options = new DisplayImageOptions.Builder()
...
.cacheInMemory(true)
.cacheOnDisk(true)
...
.build();
ImageLoader.getInstance().displayImage(imageUrl, imageView, options); // Incoming options will be used
- If you enabled disk caching then UIL try to cache images on external storage (/sdcard/Android/data/[package_name]/cache). If external storage is not available then images are cached on device's filesystem. To provide caching on external storage (SD card) add following permission to AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
- How UIL define Bitmap size needed for exact ImageView? It searches defined parameters:
- Get actual measured width and height of ImageView
- Get
android:layout_width
andandroid:layout_height
parameters - Get
android:maxWidth
and/orandroid:maxHeight
parameters - Get maximum width and/or height parameters from configuration (
memoryCacheExtraOptions(int, int)
option) - Get width and/or height of device screen
So try to set android:layout_width
|android:layout_height
or android:maxWidth
|android:maxHeight
parameters for ImageView if you know approximate maximum size of it. It will help correctly compute Bitmap size needed for this view and save memory.
- If you often got OutOfMemoryError in your app using Universal Image Loader then:
- Disable caching in memory. If OOM is still occurs then it seems your app has a memory leak. Use MemoryAnalyzer to detect it. Otherwise try the following steps (all of them or several):
- Reduce thread pool size in configuration (
.threadPoolSize(...)
). 1 - 5 is recommended. - Use
.bitmapConfig(Bitmap.Config.RGB_565)
in display options. Bitmaps in RGB_565 consume 2 times less memory than in ARGB_8888. - Use
.imageScaleType(ImageScaleType.EXACTLY)
- Use
.diskCacheExtraOptions(480, 320, null)
in configuration
- For memory cache configuration (
ImageLoaderConfiguration.memoryCache(...)
) you can use already prepared implementations.
- Cache using only strong references:
-
LruMemoryCache
(Least recently used bitmap is deleted when cache size limit is exceeded) - Used by default
-
- Caches using weak and strong references:
-
UsingFreqLimitedMemoryCache
(Least frequently used bitmap is deleted when cache size limit is exceeded) -
LRULimitedMemoryCache
(Least recently used bitmap is deleted when cache size limit is exceeded) -
FIFOLimitedMemoryCache
(FIFO rule is used for deletion when cache size limit is exceeded) -
LargestLimitedMemoryCache
(The largest bitmap is deleted when cache size limit is exceeded) -
LimitedAgeMemoryCache
(Decorator. Cached object is deleted when its age exceeds defined value)
-
- Cache using only weak references:
-
WeakMemoryCache
(Unlimited cache)
-
- For disk cache configuration (
ImageLoaderConfiguration.diskCache(...)
) you can use already prepared implementations:
-
UnlimitedDiscCache
(The fastest cache, doesn't limit cache size) - Used by default -
LruDiskCache
(Cache limited by total cache size and/or by file count. If cache size exceeds specified limit then least-recently used file will be deleted) -
LimitedAgeDiscCache
(Size-unlimited cache with limited files' lifetime. If age of cached file exceeds defined limit then it will be deleted from cache.)
NOTE: UnlimitedDiscCache is pretty faster than other limited disk cache implementations.
- To display bitmap (
DisplayImageOptions.displayer(...)
) you can use already prepared implementations:
-
RoundedBitmapDisplayer
(Displays bitmap with rounded corners) -
FadeInBitmapDisplayer
(Displays image with "fade in" animation)
- To avoid list (grid, ...) scrolling lags you can use
PauseOnScrollListener
:
boolean pauseOnScroll = false; // or true
boolean pauseOnFling = true; // or false
PauseOnScrollListener listener = new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling);
listView.setOnScrollListener(listener);
-
If you see in logs some strange supplement at the end of image URL (e.g.
https://anysite.com/images/image.png_230x460
) then it doesn't mean this URL is used in requests. This is just "URL + target size", also this is key for Bitmap in memory cache. This postfix (_230x460
) is NOT used in requests. -
ImageLoader always keeps aspect ratio of images.
You can’t perform that action at this time.