开发者

how to set a file's lastModifiedDate?

For my app I want to keep track of which files have been accessed most recently (for cache management: files used least are first to go out).

Now Android doesn't appear to have a last accessed date function for files, so I'm looking at the next best thing: file.lastModifiedDate(). That gives me the last modified date, which is effectively the creation date.

But when acces开发者_Go百科sing the file I'd like to set this value to the current time. Like Linux's touch command. How can I do this, without actually modifying the file?


This should work:

http://www.java-examples.com/set-last-modified-time-file-or-directory

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜