Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to save the deleted files like Dumpster. I am using the fileobserver, but its not working . Its notifying after the file deletion.
Java
FileObserver Observer = null; 
Observer = new FileObserver(observepath) 
{
    @Override public void onEvent(int event, String path) 
   {
        if ((FileObserver.DELETE & event)!=0 || (FileObserver.DELETE_SELF & event)!=0) 
        {
            Toast.makeText(MainActivity.this, path, Toast.LENGTH_SHORT).show();
        }
   }
}

Here the toast message is coming after the file deletion i checked this by debug mode by putting break point there. And i used "File.delete()" to delete the file. Now my question is after invoking the file.delete() is it possible to notify ?
Posted
Updated 20-Aug-13 2:14am
v4

1 solution

I think you cannot do that with FileObserver. Because there is nothing in FileObserver[^] to support that event.
Best bet would be if you find something helpful from..
How can I notify my application that one file was deleted from the SDCard (Android)?[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900