【发布时间】:2020-04-21 09:27:16
【问题描述】:
在运行 Android 10 的模拟器上,当我在 FireDescriptor 上使用 decodeFileDescriptor 时,如下所示,位图创建良好。但是当我尝试设置选项然后使用该选项对象获取位图时,选项对象似乎没有正确设置并且位图为空。请让我知道我做错了什么。感谢您的帮助。
Bitmap test1c = BitmapFactory.decodeFileDescriptor(fdCompressed);
//This works
testImgView.setImageBitmap(test1c);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFileDescriptor(fdCompressed, null, options);
//The line above sets outHeight and outWidth of options to -1
options.inJustDecodeBounds = false;
//This bitmap object is null
Bitmap test1e = BitmapFactory.decodeFileDescriptor(fdCompressed, null, options);
testImgView.setImageBitmap(test1e);
【问题讨论】:
标签: bitmapfactory android-10.0