I use the following code to write text content to MessageCleanupLogs.txt, it seems that it's a overwrite mode, when I run the code again, the previously created MessageCleanupLogs.txt is overwrite.
How can I set append mode for the file MessageCleanupLogs.txt to append new content? Thanks!
String filename=Environment.getExternalStorageDirectory() + "/MessageCleanupLogs.txt";
try
{
File file = new File(filename);
if (!file.exists()) {
file.createNewFile();
}
String aa="a\r\nb\r\nb";
FileOutputStream fOut = new FileOutputStream(filename);
OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
myOutWriter.append("test");
myOutWriter.append("\r\n");
myOutWriter.append(aa);
myOutWriter.close();
fOut.close();
} catch (Exception e) {
}