creating a folder on sd with subfolders
Try to use mkdirs()
instead of mkdir()
only, this worked for me.
Example:
File folder = new File(Environment.getExternalStorageDirectory() + "/myapp/folderone/foldertwo");
boolean success = false;
if (!folder.exists()) {
success = folder.mkdirs();
}
if (!success) {
} else {
}
Have you tried calling mkdirs()
instead of mkdir()
?
mkdir will only create the single folder specified. In your case "foldertwo".
mkdirs will create the folder specified (foldertwo) along with all other required folders in the path (myapp & folderone)