从资产不加载图像文件夹使用通用图像装载机图像、装载机、文件夹、加载

2023-09-07 23:33:58 作者:选择性失忆

我做的正是this小伙表明这是完全一样的通用图像装载机的创造者,但我仍然得到这个错误:

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?

我用这样的:

//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);

我在做什么错误或丢失?

What am I doing wrong or missing?

推荐答案

解决方案 - 我一直在寻找的jpg和我的文件扩展名是.JPG

Solution - I was looking for .jpg and my file extension was .JPG

如果NOSTRA可以张贴一些聪明的事情是在寻找我会标出你的答案,我的愚蠢作出正式答复。

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.