I want to create a file(not created) in a directory(not created) in the SDCARD. How doing it ?
Thank you.
Use This:
DocumentFile tempDir = DocumentFile.fromSingleUri(context,targetDirectoryUri);
DocumentFile newDocumentFile = tempDir.createFile(type,name);
"targetDirectoryUri" is uri of the directory you want to put the file into it. This is the only solution! After Api 19 you can not write on SDCard, so you must use DocumentFile instead File. In addition, you must also take SDCard permission. To learn how to do this and get the targetDirectoryUri, please read this.