Added in API level 11
Deprecated in API level 28

ForceLoadContentObserver


class ForceLoadContentObserver<D : Any!> : ContentObserver

An implementation of a ContentObserver that takes care of connecting it to the Loader to have the loader re-load its data when the observer is told it has changed. You do not normally need to use this yourself; it is used for you by CursorLoader to take care of executing an update when the cursor's backing data changes.

Summary

Public constructors

Public methods
Boolean

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

ForceLoadContentObserver

Added in API level 11
ForceLoadContentObserver()

Public methods

deliverSelfNotifications

Added in API level 11
fun deliverSelfNotifications(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean True if self-change notifications should be delivered to the observer.

onChange

Added in API level 11
fun onChange(selfChange: Boolean): Unit

Deprecated: Deprecated in Java.

Parameters
selfChange Boolean: True if this is a self-change notification.