开发者

How to append to a text file in android?

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

I can create a file and write to it using the above code. How do i ap开发者_Go百科pend to the text file without over writing it? thanks


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜