I need to track all the files in a folder when a file is open (FileObserver.OPEN). I want to execute a method. The problem is several times, an instance of FileObserver is going to GC, I tried this:
final MyFileObserver fo = new MyFileObserver("/mnt/sdcard/Musicas"); threadFileObserver = new Runnable() { @Override public void run() { fo.startWatching(); } }; t = new Thread(threadFileObserver); t.run();
But going. The question is, what is the best solution for an instance of FileObserver not going to?
Tks !!!
, startWatching() , Thread , . FileObserver, , . , . . FileObserver , , .
fo , / .
fo