Android 为什么BitmapFactory.decodeFile返回null?
我的代码:Android 为什么BitmapFactory.decodeFile返回null?,android,imageview,android-bitmap,Android,Imageview,Android Bitmap,我的代码: BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inJustDecodeBounds = true; Bitmap rotateBmp = BitmapFactory.decodeFile("/storage/sdcard0/FastBurstCamera/2014-09-15 05-24-07-461.jpg", opt); 文件/storage/sdcard0/FastBurstCamera/2014-0
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inJustDecodeBounds = true;
Bitmap rotateBmp = BitmapFactory.decodeFile("/storage/sdcard0/FastBurstCamera/2014-09-15 05-24-07-461.jpg", opt);
文件/storage/sdcard0/FastBurstCamera/2014-09-15 05-24-07-461.jpg存在,但rotateBmp为空,为什么
文件/storage/sdcard0/FastBurstCamera/2014-09-15 05-24-07-461.jpg存在,但rotateBmp为空,为什么
因为这就是你想要的
引述(重点加上):
解码后的位图,如果无法解码图像数据,则为null;如果opts为非null,则为,如果opts请求,则仅返回大小(在opts.outWidth和opts.outHeight中)
引述:
如果设置为true,解码器将返回null(无位图),但输出。。。字段仍将被设置,允许调用者查询位图,而不必为其像素分配内存
- 原因可能是图像尺寸太大。检查李>
- 另一个原因可能是未向清单文件添加
和/或READ\u EXTERNAL\u STORAGE
权限。你加了吗WRITE\u EXTERNAL\u STORAGE