1. Download our Official Android App: Forums for Android!

Apps Is it possible to get notification when the content of a regular file is changed

Discussion in 'Android Development' started by websurf, Mar 13, 2009.

  1. websurf

    websurf Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Mar 13, 2009

    Mar 13, 2009
    3
    0
    5
    As the title, when the content of any regular file is changed, is it possible to get notification?

    Thanks.
     

    Advertisement

  2. deepdroid

    deepdroid Newbie
    Rank:
    None
    Points:
    15
    Posts:
    15
    Joined:
    Feb 27, 2009

    Feb 27, 2009
    15
    0
    15
    I think you are looking for android.os.FileObserver.
    You implement a subclass of it, which implements onEvent().
    Then you construct a new instance of this class with the file path and maybe flags as parameters. After calling startWatching() your callback should be invoked with file changes.

    --
    deepdroid
     
  3. websurf

    websurf Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Mar 13, 2009

    Mar 13, 2009
    3
    0
    5
    Thanks for you replay, I ever tried FileObserver, it only can monitor the registered file or files just under the registered path, But I want to monitor the files under the registered path RECUSIVELY.
     

Share This Page

Loading...