我的代码:
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为空,为什么?
最佳答案
The file /storage/sdcard0/FastBurstCamera/2014-09-15 05-24-07-461.jpg exists, but the rotateBmp is null, why?
因为这就是你所要求的。
引用the documentation for decodeFile()
(强调):
The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)
引用the documentation for inJustDecodeBounds
:
If set to true, the decoder will return null (no bitmap), but the out... fields will still be set, allowing the caller to query the bitmap without having to allocate the memory for its pixels.
关于android - 为什么 BitmapFactory.decodeFile 返回 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25994072/