Android中的回收站 [英] Recycle Bin in Android

查看:201
本文介绍了Android中的回收站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我试图在android中实现回收站应用程序,我遇到了 FileObserver 类来观察所有文件,但是问题是 FileObserver 仅通知该文件在删除后被删除,这是我的代码段

Hello, 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;
    }
    //a 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

    }
}



请任何人分享您的知识来解决这个难题.这种回收站问题在这里和其他站点也被问过很多次,但是还没有适当的解决方案.

Google Play 中有一个应用程序,该应用程序的名称为 垃圾箱 正在完成任务.

请帮帮我.

在此先感谢.



Please any body share your knowledge to solve this riddle. This kind of Recycle Bin question been asked so many times here 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.

推荐答案

几天前,我回答了类似的问题.

看看-解释有关android中的记录器 [ ^ ].可能会对您有所帮助.
Some days ago I answered similar question.

Take a look - Explain about logger in android[^]. It might help you.


这篇关于Android中的回收站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆