android - BitmapFactory.decodeFile() not working with AdobeImageIntent.EXTRA_OUTPUT_URI -
i updated adobecreativesdk latest version support android nougat. after edit image in editor try edited bitmap using following code in 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(); }
before updating latest version using data.getdata() instead of data.getparcelableextra , working fine android marshmallow. bitmap returned null. have set uri of image how has been mentioned in post : https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en. tried resizing bitmap using bitmapfactory.options thinking maybe image big. not seem case.
if have uri
image better read via contentresolver
:
uri uri; context context; try { bitmap bm = bitmapfactory.decodestream(context.getcontentresolver().openinputstream(uri)); } catch (filenotfoundexception e) { e.printstacktrace(); }
contentresolver
handles underlying storage differences you. works equally fine both file://
, content://
, other uri
types.
Comments
Post a Comment