BitmapFactory.decodeResource() does not get my image from drawable

做~自己de王妃 提交于 2019-12-06 11:53:14

Do you have a bug graphic file present in the drawable folder? Have you tried to clean your project in order for R.drawable to be correctly generated?

Try this:

InputStream is = getResources().openRawResource(R.drawable.bug);
Bitmap pisc = BitmapFactory.decodeStream(new BufferedInputStream(is));

Just copy Your Drawable in all the drawable folders in your project. like this drawable-hdpi drawable-ldpi drawable-mdpi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!