FileObserver startWatching - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for FileObserver startWatching method.

This code example shows how to use the following methods:startWatching
 
    public WallpaperService(Context context) {
        if (Config.LOGD) Log.d(TAG, "WallpaperService startup");
        mContext = context;
        createFilesDir(); 
        mWallpaperObserver.startWatching();
 
        SharedPreferences preferences = mContext.getSharedPreferences(PREFERENCES,
                    Context.MODE_PRIVATE);
        mWidth = preferences.getInt(HINT_WIDTH, -1);
        mHeight = preferences.getInt(HINT_HEIGHT, -1);
    } 
     
    @Override 
    protected void finalize() throws Throwable { 
        super.finalize(); 
        mWallpaperObserver.stopWatching();
    } 
     
    public void clearWallpaper() { 
5
CodeRank
This code example shows how to use the following methods:startWatching
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        if (mFileObserver != null) {
            mFileObserver.startWatching();
        } 
    } 
 
    /** 
     * Change the directory that is currently being displayed. 
     * 
     * @param dir 
     *            The file the activity should switch to. This File must be 
     *            non-null and a directory, otherwise the displayed directory 
     *            will not be changed 
     */ 
    private void changeDirectory(File dir) {
        if (dir == null) {
            debug("Could not change folder: dir was null"); 
8
CodeRank
This code example shows how to use the following methods:startWatching
            } 
        }; 
 
        void startWatching() { 
            mRootMonitor.startWatching();
            mDownloadMonitor.startWatching();
        } 
 
        void stopWatching() { 
            mRootMonitor.stopWatching();
            mDownloadMonitor.stopWatching();
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:startWatching
 
    public WallpaperService(Context context) {
        if (Config.LOGD) Log.d(TAG, "WallpaperService startup");
        mContext = context;
        createFilesDir(); 
        mWallpaperObserver.startWatching();
 
        SharedPreferences preferences = mContext.getSharedPreferences(PREFERENCES,
                    Context.MODE_PRIVATE);
        mWidth = preferences.getInt(HINT_WIDTH, -1);
        mHeight = preferences.getInt(HINT_HEIGHT, -1);
    } 
     
    @Override 
    protected void finalize() throws Throwable { 
        super.finalize(); 
        mWallpaperObserver.stopWatching();
    } 
     
    public void clearWallpaper() { 
4
CodeRank
This code example shows how to use the following methods:startWatching
 
@Override 
protected void onResume() { 
   // TODO Auto-generated method stub 
   super.onResume(); 
   mFileObserver.startWatching();
} 
 
public void saveMedia(String fileName, byte[] data) {
 
   String imagePath = "/sdcard/sam/";
   System.out.println("Inside Folder");
 
 
   File file = new File(imagePath, fileName);
   System.out.println("File Created");
 
   FileOutputStream fileOutputStream = null;
   try { 
       fileOutputStream = new FileOutputStream(file);
4
CodeRank
This code example shows how to use the following methods:startWatching
					}// fileSaved = "New photo Saved: " + file; 
				} 
			} 
		}; 
 
		observer.startWatching(); // start the observer
	} 
 
} 
3
CodeRank
This code example shows how to use the following methods:startWatching
            } 
        }; 
 
        void startWatching() { 
            mRootMonitor.startWatching();
            mDownloadMonitor.startWatching();
        } 
 
        void stopWatching() { 
            mRootMonitor.stopWatching();
            mDownloadMonitor.stopWatching();
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:startWatching
                ServiceManager.getService(Context.WINDOW_SERVICE));
        mMonitor = new MyPackageMonitor();
        mMonitor.register(context, true);
        WALLPAPER_DIR.mkdirs();
        loadSettingsLocked(); 
        mWallpaperObserver.startWatching();
    } 
     
    @Override 
    protected void finalize() throws Throwable { 
        super.finalize(); 
        mWallpaperObserver.stopWatching();
    } 
     
    public void systemReady() { 
        if (DEBUG) Slog.v(TAG, "systemReady");
        synchronized (mLock) {
            try { 
                bindWallpaperComponentLocked(mNextWallpaperComponent);
            } catch (RuntimeException e) {
4
CodeRank
This code example shows how to use the following methods:startWatching
                ServiceManager.getService(Context.WINDOW_SERVICE));
        mMonitor = new MyPackageMonitor();
        mMonitor.register(context, true);
        WALLPAPER_DIR.mkdirs();
        loadSettingsLocked(); 
        mWallpaperObserver.startWatching();
    } 
     
    @Override 
    protected void finalize() throws Throwable { 
        super.finalize(); 
        mWallpaperObserver.stopWatching();
    } 
     
    public void systemReady() { 
        if (DEBUG) Slog.v(TAG, "systemReady");
        synchronized (mLock) {
            try { 
                bindWallpaperComponentLocked(mNextWallpaperComponent);
            } catch (RuntimeException e) {
3
CodeRank
This code example shows how to use the following methods:startWatching
		 
		photoDirectory = android.os.Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "/Camera";
		 
		//init the watching function of photo directory 
		observer = initSingleDirectoryObserver(photoDirectory);
		observer.startWatching();
	} 
	 
	@Override 
	public void onDestroy() { 
		pinMarkerDataSource.close();
		observer.stopWatching();
		super.onDestroy(); 
	} 
	 
	/** 
	 * Initiate a single observer of a given directory 
	 * @param partial path of the directory to keep watch of. 
	 */ 
	private FileObserver initSingleDirectoryObserver(String directoryPath) {
4
CodeRank

Related FileObserver startWatching Questions & Answers:

startWatching Method Overview
Start watching for events.
See Code Examples for other Android FileObserver Methods: