java.lang.Object | |
↳ | android.database.ContentObserver |
Known Direct Subclasses |
Receives call backs for changes to content.
Must be implemented by objects which are added to a
ContentObservable
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Creates a content observer.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns true if this observer is interested receiving self-change notifications.
|
||||||||||
|
Dispatches a change notification to the observer.
|
||||||||||
|
This method was deprecated
in API level 16.
Use
dispatchChange(boolean, Uri)
instead.
|
||||||||||
|
This method is called when a content change occurs.
|
||||||||||
|
This method is called when a content change occurs.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a content observer.
handler |
The handler to run
onChange(boolean)
on, or null if none.
|
---|
Returns true if this observer is interested receiving self-change notifications. Subclasses should override this method to indicate whether the observer is interested in receiving notifications for changes that it made to the content itself.
Dispatches a change notification to the observer. Includes the changed content Uri when available.
If a
Handler
was supplied to the
ContentObserver
constructor,
then a call to the
onChange(boolean)
method is posted to the handler's message queue.
Otherwise, the
onChange(boolean)
method is invoked immediately on this thread.
selfChange | True if this is a self-change notification. |
---|---|
uri | The Uri of the changed content, or null if unknown. |
This method was deprecated
in API level 16.
Use
dispatchChange(boolean, Uri)
instead.
Dispatches a change notification to the observer.
If a
Handler
was supplied to the
ContentObserver
constructor,
then a call to the
onChange(boolean)
method is posted to the handler's message queue.
Otherwise, the
onChange(boolean)
method is invoked immediately on this thread.
selfChange | True if this is a self-change notification. |
---|
This method is called when a content change occurs. Includes the changed content Uri when available.
Subclasses should override this method to handle content changes.
To ensure correct operation on older versions of the framework that
did not provide a Uri argument, applications should also implement
the
onChange(boolean)
overload of this method whenever they
implement the
onChange(boolean, Uri)
overload.
Example implementation:
// Implement the onChange(boolean) method to delegate the change notification to
// the onChange(boolean, Uri) method to ensure correct operation on older versions
// of the framework that did not have the onChange(boolean, Uri) method.
@Override
public void onChange(boolean selfChange) {
onChange(selfChange, null);
}
// Implement the onChange(boolean, Uri) method to take advantage of the new Uri argument.
@Override
public void onChange(boolean selfChange, Uri uri) {
// Handle change.
}
selfChange | True if this is a self-change notification. |
---|---|
uri | The Uri of the changed content, or null if unknown. |
This method is called when a content change occurs.
Subclasses should override this method to handle content changes.
selfChange | True if this is a self-change notification. |
---|