【发布时间】:2014-02-21 13:37:26
【问题描述】:
我想获取 lastModified() 来比较日期。 我这样做:
FileWriter file = new FileWriter(getFilesDir()+File.separator + "openliga.txt");
file.write(changeObj.toString());
file.flush();
file.close();
我通过DDMS和文件浏览器检查,文件存在!
然后
// Check the Time Stamp of the internal File
File intfile = new File(getFilesDir()+File.separator + "openliga.txt");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String dateInt = sdf.format(intfile.lastModified());
Log.e("LastMod", String.valueOf(dateInt));
告诉我:
Thu Jan 01 01:00:00 GMT+01:00 1970
有没有可能,那个android找不到文件?为什么?
【问题讨论】:
-
看起来确实找不到文件。
Returns the time when this file was last modified, measured in milliseconds since January 1st, 1970, midnight. Returns 0 if the file does not exist.
标签: android file last-modified