我完全按照这位先生的建议做了,他的建议与Universal Image Loader的创建者完全相同,但我仍然遇到了这个错误:
URI = assets://NMF0002_007.jpg
resolveUri failed on bad bitmap uri: NMF0002_007.jpg
如何确保图像被识别?
我是这样使用的:
//get the file name
String fileName = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHelper.FIELD_RESOURCE));
String imageUri = "assets://";
Log.d(TAG, "URI = " + imageUri + fileName);
ImageLoader.getInstance().displayImage(imageUri+fileName, holder.iv_details_resource);
这是我的配置:
//Get the imageloader.
ImageLoader imageLoader = ImageLoader.getInstance();
//Create image options.
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheOnDisc()
.imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
//Create a config with those options.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(options)
.discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
.build();
//Initialise the imageloader.
imageLoader.init(config);
我到底做错了什么,还是遗漏了什么重要的东西?
assets
文件夹包含哪些文件? - nostra13