I want to move a DocumentFile from one Location to another. The Uris are aquired via ACTION_OPEN_DOCUMENTTREE and stored.
However, when i try:
val resolver = context.contentResolver
val srcUri = Uri.parse(myUriFromACTION_OPEN_DOCUMENT_TREE)
val srcDocument = DocumentFile.fromTreeUri(context, srcUri)
val targetUri = anotherUriFromACTION_OPEN_DOCUMENT_TREE
DocumentsContract.moveDocument(resolver, srcUri, srcDocument.uri, targetUri )
I get an error:
java.lang.IllegalArgumentException: Invalid URI: content://com.android.externalstorage.documents/tree/primary%3Anew%20test%20folder%2FTdf%2FmayBeDeleted%2Fexterner
I have not found a way to convert the TreeUri to a normal one. Is this the problem? If so, how is it done?