[英]Where is the saved file is stored ? in Android
I used this code, but I can't find the saved file anywhere ! 我使用了这段代码,但是在任何地方都找不到保存的文件!
String filename = "fichier";
String string = "bonjour";
FileOutputStream outputStream;
try {
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(string.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
You will be able to find it if you open a new fileInputStream with the same parameters as your outputStream. 如果使用与outputStream相同的参数打开一个新的fileInputStream,则可以找到它。 You might also want to consider using SharedPreferences for something as simple as storing one String.
您可能还需要考虑将SharedPreferences用于存储一个String这样简单的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.