0
你能幫助我嗎?我在我的應用程序中使用了universal-image-loader-1.9.1-with-sources.jar,這個應用程序有太多的圖像,這些圖像稍微大一些。 ImageLoaderConfiguration的設置是OutOfMemoryError在我的應用程序中使用通用圖像加載程序
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(30 * 1024 * 1024))
.discCacheFileCount(100)
.discCacheSize(50 * 1024 * 1024)
.discCache(new UnlimitedDiscCache(createCacheDir()))
.tasksProcessingOrder(QueueProcessingType.LIFO)
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.default_small)
.showImageForEmptyUri(R.drawable.default_small)
.showImageOnFail(R.drawable.default_small)
.cacheInMemory(true)
.cacheOnDisc(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.bitmapConfig(Config.RGB_565)
.build();
@Override
public void onBackPressed() {
AnimateFirstDisplayListener a = new AnimateFirstDisplayListener();
List<String> list = a.displayedImages;
for (int i = 0; i < list.size(); i++) {
MemoryCacheUtil.removeFromCache(list.get(i),imageLoader.getMemoryCache());
}
imageLoader.clearMemoryCache();
imageLoader.clearDiscCache();
AnimateFirstDisplayListener.clearUrl();
super.onBackPressed();
}
onbackpress這種方法是沒有用的
祝您新年快樂,請接受答案 –