Code example for FileObserver

Methods: stopWatching

0
    protected void onPause() { 
	super.onPause(); 
 
	EventBus.getDefault().unregister(this);
	unregisterReceiver(mStopServerReceiver);
	observer.stopWatching();
	unregisterReceiver(connectivityChangeReceiver);
 
    } 
 
    /** 
     * onDestroy 
     */ 
    @Override 
    protected void onDestroy() { 
	super.onDestroy(); 
	ViewGroup vg = (ViewGroup) findViewById(R.layout.activity_forfragments);
	if (vg != null) {
	    vg.invalidate();
	    vg.removeAllViews();
	}