문제

When the contents of the folders are modified, the system does not update the modified date of the folders. Is there a way to set folders as modified when their contents are modified?

I tried to rename the folder to something else and renamed it back, but this doesn't change the date modified of the folder. When I do rename the folder however, it does update the date modified, but I don't want to rename the folder just for this. . . Maybe set something to the folder that is not a big deal each time the content is changed? I just need the code to alter folder and update its date modified. The listener for the content change is not needed.

Thanks in advance for your answers.

p.s. This is problem for me because I am using folders for listView and listing them by the date modified. Clicking the folder opens the content of the folder in another activity.

도움이 되었습니까?

해결책

Have you had a look at the Android reference?

public boolean setLastModified (long time) should do what you are looking for.

Using it is as simple as:

fileOrFolder.setLastModified( yourDateInMilliseconds );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top