private void writeResults() {
// TODO Auto-generated method stub
String TAG = Screen3.class.getName();
File file = new File(getFilesDir(), "history.txt");
try {
file.createNewFile();
FileWriter filewriter = new FileWriter(file, true);
BufferedWriter out = new BufferedWriter(filewriter);
out.write(workout + " - " + averageSpeed + " - " + totalDistance
+ " - " + timerText + " - " + amountDonated + "\n ");
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e(TAG, e.toString());
}
}
我有这段代码可以在锻炼后将用户的统计信息写入一个名为 history.txt 的 .txt 文件,但运行它不会出错。但是当我在手机上浏览时Android/data/packagename/
没有history.txt,这是怎么回事?