I get a tree uri from use folder, and want to know if folder exsist in case user deleted. I tried doc == null from treeUri and single, and also exists but they dont they both show not null when folder is deleted. Thanks
CodePudding user response:
Did you try to do something like that? with the findFile() method?
Uri treeUri = uri;
DocumentFile root = DocumentFile.fromTreeUri(this, treeUri);
if (root.findFile("Foldername") == null) { //create folder }
CodePudding user response:
Try to list the content of the tree.
If the tree does not exist anymore you will get an exception or a null cursor.