Share via


ContentObserver.OnChange Method

Definition

Overloads

OnChange(Boolean)

This method is called when a content change occurs.

OnChange(Boolean, Uri)

This method is called when a content change occurs.

OnChange(Boolean, Uri, Int32)

This method is called when a content change occurs.

OnChange(Boolean, ICollection<Uri>, Int32)

This method is called when a content change occurs.

OnChange(Boolean)

This method is called when a content change occurs.

[Android.Runtime.Register("onChange", "(Z)V", "GetOnChange_ZHandler")]
public virtual void OnChange (bool selfChange);
[<Android.Runtime.Register("onChange", "(Z)V", "GetOnChange_ZHandler")>]
abstract member OnChange : bool -> unit
override this.OnChange : bool -> unit

Parameters

selfChange
Boolean

True if this is a self-change notification.

Attributes

Remarks

This method is called when a content change occurs.

Subclasses should override this method to handle content changes.

Java documentation for android.database.ContentObserver.onChange(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

OnChange(Boolean, Uri)

This method is called when a content change occurs.

[Android.Runtime.Register("onChange", "(ZLandroid/net/Uri;)V", "GetOnChange_ZLandroid_net_Uri_Handler")]
public virtual void OnChange (bool selfChange, Android.Net.Uri? uri);
[<Android.Runtime.Register("onChange", "(ZLandroid/net/Uri;)V", "GetOnChange_ZLandroid_net_Uri_Handler")>]
abstract member OnChange : bool * Android.Net.Uri -> unit
override this.OnChange : bool * Android.Net.Uri -> unit

Parameters

selfChange
Boolean

True if this is a self-change notification.

uri
Uri

The Uri of the changed content.

Attributes

Remarks

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.
            {@literal @Override}
            public void onChange(boolean selfChange) {
                onChange(selfChange, null);
            }

            // Implement the onChange(boolean, Uri) method to take advantage of the new Uri argument.
            {@literal @Override}
            public void onChange(boolean selfChange, Uri uri) {
                // Handle change.
            }
</code>

</p>

Java documentation for android.database.ContentObserver.onChange(boolean, android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

OnChange(Boolean, Uri, Int32)

This method is called when a content change occurs.

[Android.Runtime.Register("onChange", "(ZLandroid/net/Uri;I)V", "GetOnChange_ZLandroid_net_Uri_IHandler", ApiSince=30)]
public virtual void OnChange (bool selfChange, Android.Net.Uri? uri, int flags);
[<Android.Runtime.Register("onChange", "(ZLandroid/net/Uri;I)V", "GetOnChange_ZLandroid_net_Uri_IHandler", ApiSince=30)>]
abstract member OnChange : bool * Android.Net.Uri * int -> unit
override this.OnChange : bool * Android.Net.Uri * int -> unit

Parameters

selfChange
Boolean

True if this is a self-change notification.

uri
Uri

The Uri of the changed content.

flags
Int32

Flags indicating details about this change.

Attributes

Remarks

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.

Java documentation for android.database.ContentObserver.onChange(boolean, android.net.Uri, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

OnChange(Boolean, ICollection<Uri>, Int32)

This method is called when a content change occurs.

[Android.Runtime.Register("onChange", "(ZLjava/util/Collection;I)V", "GetOnChange_ZLjava_util_Collection_IHandler", ApiSince=30)]
public virtual void OnChange (bool selfChange, System.Collections.Generic.ICollection<Android.Net.Uri> uris, int flags);
[<Android.Runtime.Register("onChange", "(ZLjava/util/Collection;I)V", "GetOnChange_ZLjava_util_Collection_IHandler", ApiSince=30)>]
abstract member OnChange : bool * System.Collections.Generic.ICollection<Android.Net.Uri> * int -> unit
override this.OnChange : bool * System.Collections.Generic.ICollection<Android.Net.Uri> * int -> unit

Parameters

selfChange
Boolean

True if this is a self-change notification.

uris
ICollection<Uri>

The Uris of the changed content.

flags
Int32

Flags indicating details about this change.

Attributes

Remarks

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.

Java documentation for android.database.ContentObserver.onChange(boolean, java.util.Collection<android.net.Uri>, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to