I am working on the Android SDK on Eclipse.
Whenever I look at the SDcard after running this code (either before or after closing the emulator) the file exists but its contents are empty. I have tried reading the contents after writing them, with a BufferedReader, and they are indeed there, but vanish when I open the file.
File file = new File(Constants.UPDATE_FILE);
final java.util.Calendar c = java.util.Calendar.getInstance();
if(!file.exists())
{
Log.i(TAG, "create new file");
file.createNewFile();
lastUpdate = c.getTime();
}
BufferedWriter bufferedFileWriter = new BufferedWriter(new FileWriter(file));
String dateToWrite = c.getTime().toGMTString();
bufferedFileWriter.write(dateToWrite);
bufferedFileWriter.flush();
bufferedFileWriter.close();