2

I am developing an application in which there is one external file stored on SD card. This file is replaced from time to time. I want to know how I can detect whether the file has been replaced or not.

I tried following

    File file = new File("filepath");
    Date lastModDate = new Date(file.lastModified());
    Log.w("File last modified @ : ", lastModDate.toString());

The lastmodified method always returns the date "1970-01-01", even though the file is replaced from time to time.

Can anyone suggest a sample code which detects the external file modified.

4

0 に答える 0