我正在尝试使用UIL加载图像后启动图像查看应用程序。但是,当我单击图像视图时,它会显示一张空白图片并给我一个例外:
05-25 18:34:44.908 1299-1386/com.android.gallery E/UriImage﹕ got exception decoding bitmap
java.lang.NullPointerException
at com.android.camera.Util.makeInputStream(Util.java:336)
at com.android.camera.Util.makeBitmap(Util.java:307)
at com.android.camera.Util.makeBitmap(Util.java:299)
at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:94)
at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:86)
at com.android.camera.gallery.UriImage.thumbBitmap(UriImage.java:120)
at com.android.camera.ImageGetter$ImageGetterRunnable.executeRequest(ImageGetter.java:173)
at com.android.camera.ImageGetter$ImageGetterRunnable.run(ImageGetter.java:149)
at java.lang.Thread.run(Thread.java:841)
05-25 18:34:44.908 1299-1386/com.android.gallery E/UriImage﹕ got exception decoding bitmap
java.lang.NullPointerException
at com.android.camera.Util.makeInputStream(Util.java:336)
at com.android.camera.Util.makeBitmap(Util.java:307)
at com.android.camera.Util.makeBitmap(Util.java:299)
at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:94)
at com.android.camera.ImageGetter$ImageGetterRunnable.executeRequest(ImageGetter.java:204)
at com.android.camera.ImageGetter$ImageGetterRunnable.run(ImageGetter.java:149)
at java.lang.Thread.run(Thread.java:841)
这是我的图片点击监听器:
@Override
public void onLoadingComplete(final String s, View view, Bitmap bitmap) {
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
File imageFile = DiscCacheUtil.findInCache(s, imageLoader.getDiscCache());
intent.setDataAndType(Uri.fromFile(imageFile),"image/*");
context.startActivity(intent);
}
});
}
UIL选项:
options = new DisplayImageOptions.Builder()
.showImageOnFail(android.R.drawable.ic_delete)//display stub image untiL image is loaded
.cacheInMemory(true)
.cacheOnDisc(true)
.displayer(new RoundedBitmapDisplayer(10))
.build();