如何追加到Android的一个文本文件? [英] How to append to a text file in android?

查看:101
本文介绍了如何追加到Android的一个文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FileWriter f;
try {
 f = new FileWriter(Environment.getExternalStorageDirectory()+
                 "/Text/o1"+".txt");
     f.write("Hello World");
 f.flush();
 f.close();
}

我可以创建一个文件,并使用上述code写入。我如何追加到文本文件,而不在写它?谢谢

I can create a file and write to it using the above code. How do i append to the text file without over writing it? thanks

推荐答案

使用的FileWriter(档案文件,布尔附加)构造,同时创造FileWriter的。

Use FileWriter(File file,boolean append) constructor while creating FileWriter.

这篇关于如何追加到Android的一个文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆