Code example for FileObserver

Methods: startWatching

0
		 
		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) {