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.
精彩评论