我正在使用它来查看文件是否已经存在并获取其时间戳:
File file = new File(getResources().getString(R.string.file_name));
if (file.exists()) {
Date lastModified = new Date(file.lastModified());
}
尽管我可以使用 Context.fileList() 方法看到这个文件确实存在,但上面的代码总是说它不存在。
如何获取文件的最后修改日期?
我正在使用它来查看文件是否已经存在并获取其时间戳:
File file = new File(getResources().getString(R.string.file_name));
if (file.exists()) {
Date lastModified = new Date(file.lastModified());
}
尽管我可以使用 Context.fileList() 方法看到这个文件确实存在,但上面的代码总是说它不存在。
如何获取文件的最后修改日期?