我在从资产文件夹中检索图像路径时遇到问题。
我在资产文件夹中有一个图像文件夹。在文件夹中,我有三个不同的文件夹。
这是我使用的代码:
String IntroImage1= "" + languageSelected + "/" + Intro1ImagePath + ".png" ;
try{
AssetManager mngr =getAssets();
InputStream BulletImgInput = mngr.open(IntroImage1);
//InputStream BulletImgInput = mngr.open("image/Malay/bullet.png");
Bitmap bitmapBullet = BitmapFactory.decodeStream(BulletImgInput);
BulletImage.setImageBitmap(bitmapBullet);
}catch(final IOException e){
e.printStackTrace();
}
我想知道为什么我不能显示图像?因为我试图通过这段代码来检索它:
InputStream BulletImgInput = mngr.open("image/Malay/bullet.png");
它确实检索了文件,但是我在mngr.open中替换的字符串没有显示出来。
真的需要你们帮忙。谢谢。