我想創建一個目錄和代碼運行而不引發異常,但目錄沒有創建(使用Mac上的Android文件傳輸應用程序進行檢查)。日誌中沒有條目。這裏出了什麼問題? 權限到位目錄沒有創建
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
下面的代碼:
File path = getFilesDir();
File filenew = null;
try {
filenew= new File(path+"/equation");
filenew.mkdirs();
} catch (Exception e) {
e.printStackTrace();
}
getFilesDir()「的getPath +。 /等式「 –
可能du plicate [如何在Android中創建目錄?](http://stackoverflow.com/questions/4776426/how-to-create-a-directory-in-android) – duggu
嘗試'File filenew = new File(getFilesDir( ),「equation」);)filenew.mkdirs()' –