I'm trying to implement Recycle Bin application in android, I came across FileObserver
class to observe all the files, but the problem is FileObserver
only notifies that file is deleted after file deletion, here is my code snippet
public void onEvent(int event, String path) {
if (path == null) {
return;
}
//File was deleted from the monitored directory
if ((FileObserver.DELETE & event)!=0) {
//Here I want to copy File some where else then I am getting
//'File Not found exception' because file is already
// deleted before reaching this point of code
}
}
Please any body share your knowledge to solve this riddle. This kind of Recycle Bin
question been asked so many times here in stackoverflow
and in other sites too, but no proper solutions yet.
There is an application in Google Play
and the name of that application is Dumpster
which is achieving the task.
Please help me.
Thanks in advance.