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
    权限。你加了吗

感谢您友好的回答,根据您的建议,我删除了“opt.inJustDecodeBounds=true;”,然后它就可以工作了。再次感谢你!