I want to write some texts in a new line into an existing file.I tried following code but failed,Can any one suggest how can I append to file in a new row.
private void writeIntoFile1(String str) {
try {
fc=(FileConnection) Connector.open("file:///SDCard/SpeedScence/MaillLog.txt");
OutputStream os = fc.openOutputStream(fc.fileSize());
os.write(str.getBytes());
os.close();
fc.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
and calling
writeIntoFile1("aaaaaaaaa");
writeIntoFile1("bbbbbb");
Its successfully writing to the file I simulated(SDCard) but its appears in the same line. How can I write "bbbbbb" to new line?