Added in API level 1

SelfContentObserver


protected open class SelfContentObserver : ContentObserver

Cursors use this class to track changes others make to their URI.

Summary

Public constructors

Public methods
open Boolean

open Unit
onChange(selfChange: Boolean)

Inherited functions
Unit dispatchChange(selfChange: Boolean)

Dispatches a change notification to the observer.

If a Handler was supplied to the ContentObserver constructor, then a call to the #onChange method is posted to the handler's message queue. Otherwise, the #onChange method is invoked immediately on this thread.

Unit dispatchChange(selfChange: Boolean, uri: Uri?)

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 method is posted to the handler's message queue. Otherwise, the #onChange method is invoked immediately on this thread.

Unit dispatchChange(selfChange: Boolean, uri: Uri?, flags: Int)

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 method is posted to the handler's message queue. Otherwise, the #onChange method is invoked immediately on this thread.

Unit dispatchChange(selfChange: Boolean, uris: MutableCollection<Uri!>, flags: Int)

Dispatches a change notification to the observer. Includes the changed content Uris when available.

If a Handler was supplied to the ContentObserver constructor, then a call to the #onChange method is posted to the handler's message queue. Otherwise, the #onChange method is invoked immediately on this thread.

Unit onChange(selfChange: Boolean, uri: Uri?)

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 richer arguments, applications should implement all overloads.

Example implementation:

<code>
  // 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.
  }
  </code>

Unit onChange(selfChange: Boolean, uri: Uri?, flags: Int)

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 richer arguments, applications should implement all overloads.

Unit onChange(selfChange: Boolean, uris: MutableCollection<Uri!>, flags: Int)

This method is called when a content change occurs. Includes the changed content Uris 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 richer arguments, applications should implement all overloads.

Public constructors

SelfContentObserver

Added in API level 1
SelfContentObserver(cursor: AbstractCursor!)

Public methods

deliverSelfNotifications

Added in API level 1
open fun deliverSelfNotifications(): Boolean
Return
Boolean True if self-change notifications should be delivered to the observer.

onChange

Added in API level 1
open fun onChange(selfChange: Boolean): Unit
Parameters
selfChange Boolean: True if this is a self-change notification.