Question

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.

Was it helpful?

Solution

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 );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top