在内存不足的解决方案中:Strange out of memory issue while loading an image to a Bitmap object,它讨论了使用:decodeFile(File f)。如何处理被称为R.id.something的内部图像文件?这些资源被视为整数?
答案 0 :(得分:2)
您可以使用decodeResource():
Bitmap bm = BitmapFactory.decodeResource(getResources(),R.id.someimage);
或
Bitmap bm = BitmapFactory.decodeResource(getResources(),R.id.someimage,options);