问题
I do exactly what this guy suggests which is exactly the same as the creator of the Universal Image Loader, but I still get this error:
URI = assets://NMF0002_007.jpg
resolveUri failed on bad bitmap uri: NMF0002_007.jpg
What should I look for to ensure that the images are recognised?
I use it like this:
//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);
This is my configuration:
//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);
What am I doing wrong or missing?
回答1:
Solution - I was looking for .jpg and my file extension was .JPG
If NOSTRA can post some clever things to be on the lookout for I'll mark your answer as an official answer to my silliness.
来源:https://stackoverflow.com/questions/18034576/images-not-loading-from-assets-folder-using-universal-image-loader