Everything in question. Here is my code:
private void createDirectory(File currentDirectory) {
File f = null;
try {
f = new File(currentDirectory.getCanonicalPath() + "/directory"
+ count);
boolean success = f.mkdir();
if (!success) {
Toast.makeText(currentContext,
f.getName() + " could not be created", 15).show();
}
} catch (IOException ioe) {
Toast.makeText(currentContext,
f.getName() + " could not be created", 15).show();
}
count++;
}
I am writing a small file manager in Android, and I would like to add the ability to create a directory. There is no exception, and the success variable always returns false. Can someone tell me what is wrong, my code?
Thanks for your advice!
[EDIT]
BTW. When the phone is in development mode, does the application have write access to the SD card? I program on my phone (Acer liquid)
source
share