【发布时间】:2013-11-21 12:00:31
【问题描述】:
我尝试从 res/raw 文件夹中解码位图(1920x1920),这是一个 png 资源。我需要全尺寸位图。我想使用 BimtapFactory.decodeFileDescriptor 而不是 BitmapFactory.decodeFile||decodeResource 因为比其他人处理 OOM 的可靠性更高: 当我尝试这段代码时,位图为空!!!但该文件不为空。我一直在努力打球。 请帮忙!
Context mCtx=MainActivity.this;
Bitmap bm = null;
//id is the resId in res/raw
AssetFileDescriptor file =mCtx.getResources().openRawResourceFd(R.raw.skin_default_0);
bm = BitmapFactory.decodeFileDescriptor(file.getFileDescriptor(), null,
options);
【问题讨论】: