所以我在下面有这段代码MainActivity
,在我调用这个方法后,它会弹出Toast
“文件已保存”,但我无法找到这个文件以确保它保存了我想要的东西,有人吗?
private void saveToFile(String data){
try {
outFile = new FileWriter(Environment.getExternalStorageDirectory().getAbsolutePath()+"/batteryLogFile.txt", true);
PrintWriter out = new PrintWriter(outFile);
out.println(data);
out.close();
//output = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath()+"/batteryLogFile.txt");
//output.write(data.getBytes());
//output.close();
Toast.makeText(getBaseContext(), "file saved", Toast.LENGTH_SHORT).show();
}catch(FileNotFoundException e){
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}catch(java.io.IOException e){
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}