FileDocCategorySizeDatePackage
ContentObservable.javaAPI DocAndroid 5.1 API3327Thu Mar 12 22:22:10 GMT 2015android.database

ContentObservable

public class ContentObservable extends Observable
A specialization of {@link Observable} for {@link ContentObserver} that provides methods for sending notifications to a list of {@link ContentObserver} objects.

Fields Summary
Constructors Summary
Methods Summary
public voiddispatchChange(boolean selfChange)
Invokes {@link ContentObserver#dispatchChange(boolean)} on each observer.

If selfChange is true, only delivers the notification to the observer if it has indicated that it wants to receive self-change notifications by implementing {@link ContentObserver#deliverSelfNotifications} to return true.

param
selfChange True if this is a self-change notification.
deprecated
Use {@link #dispatchChange(boolean, Uri)} instead.

        dispatchChange(selfChange, null);
    
public voiddispatchChange(boolean selfChange, android.net.Uri uri)
Invokes {@link ContentObserver#dispatchChange(boolean, Uri)} on each observer. Includes the changed content Uri when available.

If selfChange is true, only delivers the notification to the observer if it has indicated that it wants to receive self-change notifications by implementing {@link ContentObserver#deliverSelfNotifications} to return true.

param
selfChange True if this is a self-change notification.
param
uri The Uri of the changed content, or null if unknown.

        synchronized(mObservers) {
            for (ContentObserver observer : mObservers) {
                if (!selfChange || observer.deliverSelfNotifications()) {
                    observer.dispatchChange(selfChange, uri);
                }
            }
        }
    
public voidnotifyChange(boolean selfChange)
Invokes {@link ContentObserver#onChange} on each observer.

param
selfChange True if this is a self-change notification.
deprecated
Use {@link #dispatchChange} instead.

        synchronized(mObservers) {
            for (ContentObserver observer : mObservers) {
                observer.onChange(selfChange, null);
            }
        }
    
public voidregisterObserver(ContentObserver observer)

        super.registerObserver(observer);