Code example for ContentObserver

Methods: onChange

0
	/** 
	 * Often called in an activity's onResume method. 
	 */ 
	public void enableStateUpdates() { 
		Uri uri = mDbFeed.getUri();
		mMusubi.getContext().getContentResolver().registerContentObserver(uri, false, mObserver);
		mObserver.onChange(false); // keep getLatestState() synchronized
		mObservingUpdates = true;
	} 
 
	/** 
	 * Often called in an activity's onPause method. 
	 */ 
	public void disableStateUpdates() { 
		mMusubi.getContext().getContentResolver().unregisterContentObserver(mObserver);
		mObservingUpdates = false;
	} 
 
	public User getLocalUser() { 
		return mDbFeed.getLocalUser();
	}