一切都在问题中。这里是我的代码:如何在Android中创建一个目录?
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++;
}
我写在Android的一个小文件管理器,我想补充创建目录的可能性。没有例外,变量的成功总是返回false。 有人可以告诉我什么是错的我的代码?
Thx为您的建议!
[编辑]
顺便说一句,当手机处于DEVELOPPEMENT模式,不应用对SD卡的写访问?我编程我的手机上(宏碁Liquid)
是的,我知道。但这是我得到它的方式。感谢您的回答 – Dimitri 2011-01-23 21:00:41