FileDocCategorySizeDatePackage
ContentObserver.javaAPI DocAndroid 1.5 API3978Wed May 06 22:41:54 BST 2009android.database

ContentObserver

public abstract class ContentObserver extends Object
Receives call backs for changes to content. Must be implemented by objects which are added to a {@link ContentObservable}.

Fields Summary
private Transport
mTransport
private Object
lock
android.os.Handler
mHandler
Constructors Summary
public ContentObserver(android.os.Handler handler)
onChange() will happen on the provider Handler.

param
handler The handler to run {@link #onChange} on.

        mHandler = handler;
    
Methods Summary
public booleandeliverSelfNotifications()
Returns true if this observer is interested in notifications for changes made through the cursor the observer is registered with.

        return false;
    
public final voiddispatchChange(boolean selfChange)

        if (mHandler == null) {
            onChange(selfChange);
        } else {
            mHandler.post(new NotificationRunnable(selfChange));
        }
    
public IContentObservergetContentObserver()
Gets access to the binder transport object. Not for public consumption. {@hide}

        synchronized(lock) {
            if (mTransport == null) {
                mTransport = new Transport(this);
            }
            return mTransport;
        }
    
public voidonChange(boolean selfChange)
This method is called when a change occurs to the cursor that is being observed.

param
selfChange true if the update was caused by a call to commit on the cursor that is being observed.

public IContentObserverreleaseContentObserver()
Gets access to the binder transport object, and unlinks the transport object from the ContentObserver. Not for public consumption. {@hide}

        synchronized(lock) {
            Transport oldTransport = mTransport;
            if (oldTransport != null) {
                oldTransport.releaseContentObserver();
                mTransport = null;
            }
            return oldTransport;
        }