1
我想使用以下代碼將數據保存在輸出文件中。但是我不知道在應用程序執行後我在哪裏找到這個文件。我在哪裏找到由android應用程序修改的文件
try {
// open myfilename.txt for writing
OutputStreamWriter out = new OutputStreamWriter(openFileOutput("myfile.txt", Context.MODE_PRIVATE));
// write the contents on mySettings to the file
out.write("x="+Float.toString(xx)+" y="+Float.toString(yy)+" z="+Float.toString((zz))+" Puissance="+Float.toString(magneticStrenght));
// close the file
out.close();
} catch (java.io.IOException e) {
//do something if an IOException occurs.
Log.e("Exception", "File write failed: " + e.toString());
}
謝謝你的回答。
謝謝你的回答。所以我不能簡單地將文件保存在內部存儲器中? – fao
是的,你可以保存它。但請告訴我你想要保存文件的位置。我給你這個答案將文件保存在手機內存的內部存儲器中。不在應用程序存儲中。 –