[英]How to open a JPG file as a BITMAP stored on the …/res/drawable-hdpi/?
I want to open a JPG file as Bitmap that stored on drawable-hdpi
folder. 我想打开一个JPG文件作为Bitmap并存储在
drawable-hdpi
文件夹中。 But i do not use R.drawable.filename
, because I don`t know its name. 但是我不使用
R.drawable.filename
,因为我不知道它的名字。 I only have a String of its name. 我只有一个名称为String的字符串。
String IMAGE = String.valueof(Random());
In otherwise, I want to open an Image file with name IMAGE stored on the .../res/drawable-hdpi/
. 否则,我想打开一个图像文件,名称为IMAGE,存储在
.../res/drawable-hdpi/
。
Thanks for any help. 谢谢你的帮助。
您可以通过以下方式获取位图
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.myimage);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.