private FileObserver createFileObserver ( final String path ) { return new FileObserver ( path , FileObserver . CREATE | FileObserver . DELETE | FileObserver . MOVED_FROM | FileObserver . MOVED_TO ) { @ Override public void onEvent ( final int event , final String path ) { debug ( "FileObserver received event %d" , event ) ; final Activity activity = getActivity ( ) ; if ( activity != null ) { activity . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { refreshDirectory ( ) ; } } ) ; } } } ; }
Sets up a FileObserver to watch the current directory .