gpt4 book ai didi

android - 为什么 BitmapFactory.decodeFile 返回 null?

转载 作者:行者123 更新时间:2023-11-29 15:14:27 31 4
gpt4 key购买 nike

我的代码:

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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com