[英]Cannot Open Image in assets folder for Android App
Just like the title says, i can't seem to get the images in my assets folder to open up. 就像标题中所说的那样,我似乎无法在我的资产文件夹中打开图像。
public static final String CONTENT_URI = "file:///android:asset/";
Uri tmp = Uri.parse(CONTENT_URI + s);
holder.image.setImageURI(tmp);
I have tried a bunch of different syntax's, and I can't seem to get the asset to be detected. 我尝试了多种不同的语法,但似乎无法检测到资产。 Keep getting resolveUri errors about it not finding the files.
不断收到关于找不到文件的resolveUri错误。
s
is a string such as hears.png
which is indeed in the assets folder. s
是一个字符串,例如hears.png
,它的确存在于资产文件夹中。
This is what you need to get images from asset 这就是从资产中获取图像所需要的
yourImageView.setImageBitmap(BitmapFactory.decodeStream(activity.getResources().getAssets().open("whateverResorce.png")));
Regards! 问候!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.