New with Android. Sorry! I’m trying to create the following…
- Wait for Timer to Finish. (No issues here).
- Write time to a log file.
- Activate Timer again.
- Go back to step 1 & repeat.
The code for writing to the file is as follows…
File file = new File("/sdcard/log.txt");
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(str);
writer.newLine();
writer.flush();
writer.close();
The code is only writing the last .write in the file! The previous WRITE is removed. I suspect that its creating a new file everytime and writing the latest line. I tried with FOS and OSW but with same results! Please help, am stuck on this one for almost 48 hours.
Use the
FileWriterin append mode.