一切都在問題中。這裏是我的代碼:如何在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