[英]How I access asset folder?
I need to load image from assets in folder like this我需要从这样的文件夹中的资产加载图像
and my code just check that how i can access my folder (sorry from poor coding)我的代码只是检查我如何访问我的文件夹(对不起,编码不好)
public Bitmap test3(){
Bitmap bitmap = null;
AssetManager assManager = null;
try {
InputStream is = assManager.open("train/c00/Astb412_400_30_18_161.bmp");
bitmap = BitmapFactory.decodeStream(is);
return bitmap;
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}
So, I just test debug to see but it didn't work test debug所以,我只是测试调试看看,但它没有工作测试调试
I don't know how I access file.我不知道我如何访问文件。 please help
请帮忙
Better and most suitable way is to put your asset in res folder.更好和最合适的方法是将您的资产放在 res 文件夹中。 After that you can assess them like this.
之后,您可以像这样评估它们。
Drawable image = getResources().getDrawable(R.drawable.your_file_name_goes_here);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.