hello everyone i set cache but it seems no effect on my device.Here is my code:
private static final int MAX_DISK_CACHE_VERYLOW_SIZE = 20 * ByteConstants.MB;
private static final int MAX_DISK_CACHE_LOW_SIZE = 60 * ByteConstants.MB;
private static final int MAX_DISK_CACHE_SIZE = 100 * ByteConstants.MB;
final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
MAX_MEMORY_CACHE_SIZE,
Integer.MAX_VALUE,
MAX_MEMORY_CACHE_SIZE,
Integer.MAX_VALUE,
Integer.MAX_VALUE);
Supplier<MemoryCacheParams> mSupplierMemoryCacheParams = new Supplier<MemoryCacheParams>() {
@Override
public MemoryCacheParams get() {
return bitmapCacheParams;
}
};
ImagePipelineConfig.Builder configBuilder = ImagePipelineConfig.newBuilder(context)
.setBitmapsConfig(Bitmap.Config.RGB_565)
.setBitmapMemoryCacheParamsSupplier(mSupplierMemoryCacheParams)
.setMainDiskCacheConfig(diskCacheConfig)
.setMemoryTrimmableRegistry(NoOpMemoryTrimmableRegistry.getInstance());
`
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder().setBaseDirectoryPath(Environment.getExternalStorageDirectory().getAbsoluteFile())
.setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
.setMaxCacheSize(MAX_DISK_CACHE_SIZE)
.setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE)
.setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE)
.setDiskTrimmableRegistry(NoOpDiskTrimmableRegistry.getInstance())
.build();`
i changed MAX_DISK_CACHE_VERYLOW_SIZE,MAX_DISK_CACHE_LOW_SIZE,MAX_DISK_CACHE_SIZE to 10,20,30,but it cannot work.
Hi!
Please take a look at the Image pipeline configuration documentation, which explains how you can customize all caches.