创建输入(新线)在android系统全自动文本文件 [英] Create enter (new line) automaticly text file in android
本文介绍了创建输入(新线)在android系统全自动文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做了一个的创建文件的应用程序的在Android中,我想写一个字符串变量 file.txt的
,它应该自动插入输入
(导航到新行)
I made a create file app in android, I want to write a string variable to file.txt
, and it should automatically insert an enter
(navigate to new line)
我用:
public void cekFile() {
File root = Environment.getExternalStorageDirectory();
try {
BufferedWriter fw = new BufferedWriter(new FileWriter(new File(
"/data/log/log.txt"), true));
if (root.canWrite()) {
fw.write("Monitoring Panggilan" + "\n");
fw.close();
}
} catch (IOException e) {
Log.e("One", "Could not write file " + e.getMessage());
}
}
这不是导航到新行。
It's not navigating to new line.
推荐答案
之前或 FW后使用
方法。 fw.newLine()
方法。写()
Use the fw.newLine()
method before or after the fw.write()
method.
这篇关于创建输入(新线)在android系统全自动文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文