我使用通用图像加载程序库在2.3.3 LGP500上。 我有以下问题:如果我以某种方式退出或只是暂停 在列表视图中下载图像时的活动,我收到了很多 LogCat中的异常;每个例外都有相同的原因:
System.err java.io.IOException: BufferedInputStream is close.
好的,我怎么处理这个?我应该使用nostra13中描述的监听器吗? 文档?
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
...
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
...
}
提前致谢。
编辑:这不是在N4上发生的4.4。
EDIT2:我使用的是1.9.0 UIL。这是我的配置:
public static void initImageLoader(Context context) {
DisplayImageOptions options = new DisplayImageOptions.Builder()
.resetViewBeforeLoading(true).cacheInMemory(true)
.cacheOnDisc(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.showImageForEmptyUri(R.drawable.photo_placeholder)
.showImageOnFail(R.drawable.photo_placeholder).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context).memoryCacheExtraOptions(200, 200)
.discCacheExtraOptions(200, 200, CompressFormat.JPEG, 75, null)
.threadPoolSize(5).denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.defaultDisplayImageOptions(options).build();
L.disableLogging();
ImageLoader.getInstance().init(config);
}
logcat的:
01-11 13:01:21.249: W/System.err(4614): java.io.IOException: BufferedInputStream is closed
01-11 13:01:21.299: W/System.err(4614): at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:116)
01-11 13:01:21.299: W/System.err(4614): at java.io.BufferedInputStream.read(BufferedInputStream.java:274)
01-11 13:01:21.309: W/System.err(4614): at org.apache.harmony.luni.internal.net.www.protocol.http.UnknownLengthHttpInputStream.read(UnknownLengthHttpInputStream.java:40)
01-11 13:01:21.309: W/System.err(4614): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:166)
01-11 13:01:21.309: W/System.err(4614): at java.io.BufferedInputStream.read(BufferedInputStream.java:324)
01-11 13:01:21.309: W/System.err(4614): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
01-11 13:01:21.309: W/System.err(4614): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
01-11 13:01:21.309: W/System.err(4614): at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.defineImageSizeAndRotation(BaseImageDecoder.java:90)
01-11 13:01:21.349: W/System.err(4614): at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:70)
01-11 13:01:21.349: W/System.err(4614): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadSizedImage(LoadAndDisplayImageTask.java:342)
01-11 13:01:21.369: W/System.err(4614): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisc(LoadAndDisplayImageTask.java:319)
01-11 13:01:21.379: W/System.err(4614): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:260)
01-11 13:01:21.379: W/System.err(4614): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:128)
01-11 13:01:21.379: W/System.err(4614): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
01-11 13:01:21.379: W/System.err(4614): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
01-11 13:01:21.389: W/System.err(4614): at java.lang.Thread.run(Thread.java:1019)