I've followed this How to use the new SD card access API presented for Android 5.0 (Lollipop)? but still not satisfy my problem.
My application is almost similar to ES Explorer, where it will display all files to edit. When user finish editing the file, it will save the changes through this call OtherPartyImageSaver.save(File f, Metadata updatedMetadata)
I tried the following, but failed:
Uri treeUri = resultData.getData();
DocumentFile pickedDir = DocumentFile.fromTreeUri(this, treeUri);
OtherPartyImageSaver.save(new File("/storage/sdcard/Download/hello.jpg"),
updatedMetadata);
This class doesn't work with OutputStream
.
Do I have to give up on OtherPartyImageSaver
or is there any way to achieve this?
If I have to give up with the library, can Uri from other provider be granted for modification?
Uri mediaUri = Uri.withAppendedPath(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
"45");
Because the Uri _ID is retrieved by querying database.