我最近用最新版本更新了 adobecreativesdk 以支持 Android Nougat。在编辑器中编辑图像后,我尝试在 onActivityResult 中使用以下代码获取编辑后的位图:
mImageUri = data.getParcelableExtra(AdobeImageIntent.EXTRA_OUTPUT_URI);
Bitmap bitmap = BitmapFactory.decodeFile(mImageUri.getPath());
if(bitmap!=null)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
imagebytes = baos.toByteArray();
PlayAnimation();
}
在更新到最新版本之前,我使用的是 data.getData() 而不是 data.getParcelableExtra,它适用于 Android Marshmallow。但现在我的位图总是返回为空。我已经设置了图像的 URI,就像在这篇文章中提到的那样: https ://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat /zh。我还尝试使用 BitmapFactory.Options 调整位图的大小,认为图像可能太大了。但似乎并非如此。