I am tring to record the wake time and sleep time from a dialog picker to a text file like this, but the call to the method commitToFile2 doesn\'t append the text file \"sa
In your commitToFile2()
method, after fw.append(entryString);
try adding fw.flush();
FileWriter
is a subclass of OutputStreamWriter
and the write()
methods of that class will not necessarily 'flush' data automatically.
that's so you retain your MODE_WORLD_READABLE
openFileOutput("savedData.txt", MODE_APPEND | MODE_WORLD_READABLE );
I figured it out....I had to change the line
FileOutputStream fOut = openFileOutput("savedData.txt", MODE_WORLD_READABLE);
to
FileOutputStream fOut = openFileOutput("savedData.txt", MODE_APPEND);
After that I was able to append the text file without overwriting the data that was already inside the text file. Thanks for your assistance guys. I guess going to the 4th page on google IS useful sometimes.