I am trying to determine when a file is modified. Currently I have a class file observer class that contains
public class fileObserver extends FileObserver {
public String absolutePath;
public fileObserver(String path) {
super(path, FileObserver.ALL_EVENTS);
absolutePath = path;
}
@Override
public void onEvent(int event, String path) {
if (path == null) {
return;
}
if (event == FileObserver.MODIFY) {
Log.d("change","changed");
}
}
}
and in my main activity I have
fileObserver test = new fileObserver(fullpathnamehere);
test.startWatching();
fullpathnamehere is the file path of the file that I am trying to observe. I checked and the file path is valid. Can anyone tell me what I'm doing wrong?