I am currently building a file management app that allows the user to browse the file system of their device. The user starts off in the root directory / of the
Try with this. It works fine for me.
final String NEW_FOLDER_NAME = "TestFolder";
String extStore = System.getenv("EXTERNAL_STORAGE");
File f_exts = new File(extStore, NEW_FOLDER_NAME);
String secStore = System.getenv("SECONDARY_STORAGE");
File f_secs = new File(secStore, NEW_FOLDER_NAME);
testPath(f_exts);
textPath(f_secs);
and change boolean value in testPath function as follows
boolean success;
if(path.exists()) {
// already created
success = true;
} else {
success = path.mkdir();
}
If folder already exists, path.mkdir() method return false.
and done.!!!
reference from this question.