Android中的OutOfMemory

时间:2011-01-12 12:02:42

标签: android memory-management

在内存不足的解决方案中:Strange out of memory issue while loading an image to a Bitmap object,它讨论了使用:decodeFile(File f)。如何处理被称为R.id.something的内部图像文件?这些资源被视为整数?

1 个答案:

答案 0 :(得分:2)

您可以使用decodeResource():

Bitmap bm = BitmapFactory.decodeResource(getResources(),R.id.someimage);

Bitmap bm = BitmapFactory.decodeResource(getResources(),R.id.someimage,options);