简体   繁体   English

如何打开JPG文件作为保存在…/ res / drawable-hdpi /中的BITMAP?

[英]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.

相关问题 如何获取保存在res / drawable-hdpi文件夹中的jpg的ID? - How can one get the ID of a jpg saved in res/drawable-hdpi folder? Android 资源问题:如何获取 res/drawable-hdpi 文件夹的标识符? - Android resources problem: How to getIdentifier for a res/drawable-hdpi folder? WebView如何获取本地res \\ drawable-hdpi图像路径 - WebView how to get local res\drawable-hdpi image path 如何使用res文件夹的drawable-hdpi,drawable-mdpi,drawable-ldpi中存在的图像? - how to use images present in drawable-hdpi,drawable-mdpi,drawable-ldpi of res folder? 单击按钮时,从库中的res / drawable-hdpi打开图像 - Open image from res/drawable-hdpi in gallery when clicking a button 我想将我的animation.zip文件解压缩到res / drawable-hdpi - I want to unzip my animation.zip file in to the res/drawable-hdpi 如何将android位图别名为另一个大小的drawable(drawable-large-mdpi别名为drawable-hdpi) - How can I alias an android bitmap to a drawable from another size (drawable-large-mdpi aliases to drawable-hdpi) 如何同时使用可绘制和可绘制hdpi中的资源? - how to use resources from drawable and drawable-hdpi at the same time? 如何使用存储在SDCARD上的JPG将JPG文件作为BITMAP打开? - How to open a JPG file as a BITMAP with the JPG stored on the SDCARD? Android:如何在drawable-hdpi中放置具有不同分辨率的相同图像 - Android: how to place same image with different resoultion in drawable-hdpi
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM