Is SAF intended to replace File handling in external directories, in a certain future?
I hope it is not so in the end, but I am testing SAF itself in advance. It would be useful for other reasons too.
Let's say I am using this method:
static public DocumentFile createFolderInFolder(Activity activity,String parentFolderUriString,String folderName)
{
DocumentFile result=null;
ContentResolver contentResolver;
contentResolver = activity.getContentResolver();
Uri parentFolderUri=null;
Uri oldParentUri = Uri.parse(parentFolderUriString);
String id = DocumentsContract.getTreeDocumentId(oldParentUri);
parentFolderUri= DocumentsContract.buildChildDocumentsUriUsingTree(oldParentUri,id);
DocumentFile parentFolder = DocumentFile.fromTreeUri(activity, parentFolderUri);
result=parentFolder.createDirectory(folderName);
return result;
}
It creates a directory inside another directory.
When attempting to create an existing folder, for instance "folderName", a new folder is created with a similar name "folderName (1)".
Is there a way to avoid this, so that a new folder is not created if existing? (And the same for files)