【发布时间】:2014-01-10 11:03:49
【问题描述】:
我已经实现了一个自己的下载器,但他似乎没有使用他已经检索到的缓存中的图像。我的初始化:
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.imageDownloader(new SocketDownloader(this))
.memoryCacheSizePercentage(25)
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
这是我在 logcat 中找到的:
01-10 11:47:26.899: D/ImageLoader(2345): Start display image task [socket://images/test-
icon-1.png_53x53]
01-10 11:47:26.899: D/ImageLoader(2345): Load image from network [socket://images/test-
icon-1.png_53x53]
01-10 11:47:26.899: D/Request(2345): request {"path":"images\/test-
icon-1.png","action":"getimage","actionid":0}
01-10 11:47:28.719: D/ImageLoader(2345): Subsample original image (200x200) to 100x100
(scale = 2) [socket://images/test-icon-1.png_53x53]
01-10 11:47:28.729: D/ImageLoader(2345): ImageAware is reused for another image. Task is
cancelled. [socket://images/test-icon-1.png_53x53]
01-10 11:47:28.839: D/ImageLoader(2345): Start display image task [socket://images/test-
icon-1.png_53x53]
01-10 11:47:28.839: D/ImageLoader(2345): Load image from network [socket://images/test-
icon-1.png_53x53]
01-10 11:47:28.839: D/Request(2345): request {"path":"images\/test-
icon-1.png","action":"getimage","actionid":0}
在 nexus 7 上运行,它实际上应该有足够的堆来执行 2 个图像的操作。感谢您回复有用的提示。
【问题讨论】:
-
您是否在
DisplayImageOptions中启用了缓存? -
这是我的配置:DisplayImageOptions opts = new DisplayImageOptions.Builder() .extraForDownloader(new ImageSocketDownloaderExtra(request, actionId)) .considerExifParams(false) .cacheInMemory() .build();
标签: android image imageview universal-image-loader