Is it possible to reset the last modified date of an Android file?

旧街凉风 提交于 2019-12-07 10:00:26

setLastModified() is a standard method on any Java File object that you can use to update this value.

SDK Documentation.

elprl

As Nik said the setLastModified() method on the File class may not always work depending where you are in the Android file system. If on the SD Card then some devices will return false from that call and thus not change the date.

There are more details about it here:

http://code.google.com/p/android/issues/detail?id=1992

http://code.google.com/p/android/issues/detail?id=1699

Plus some other stackoverflow thread here:

file.lastModified() is never what was set with file.setLastModified()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!