緣由是由於沒有刷新,寫入文件後執行如下代碼便可。this
根目錄路徑:spa
File newfile = new File(Environment.getExternalStorageDirectory() + "/1.txt");
MediaScannerConnection.scanFile(this, new String[]{newfile.getAbsolutePath()}, null, null);
說明:
newfile是寫入的路徑