Udostępnij za pośrednictwem


ContentResolver.RegisterContentObserver(Uri, Boolean, ContentObserver) Method

Definition

Register an observer class that gets callbacks when data identified by a given content URI changes.

[Android.Runtime.Register("registerContentObserver", "(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V", "")]
public void RegisterContentObserver (Android.Net.Uri uri, bool notifyForDescendants, Android.Database.ContentObserver observer);
[<Android.Runtime.Register("registerContentObserver", "(Landroid/net/Uri;ZLandroid/database/ContentObserver;)V", "")>]
member this.RegisterContentObserver : Android.Net.Uri * bool * Android.Database.ContentObserver -> unit

Parameters

uri
Uri

The URI to watch for changes. This can be a specific row URI, or a base URI for a whole class of content.

notifyForDescendants
Boolean

When false, the observer will be notified whenever a change occurs to the exact URI specified by uri or to one of the URI's ancestors in the path hierarchy. When true, the observer will also be notified whenever a change occurs to the URI's descendants in the path hierarchy.

observer
ContentObserver

The object that receives callbacks when changes occur.

Attributes

Remarks

Register an observer class that gets callbacks when data identified by a given content URI changes.

Starting in android.os.Build.VERSION_CODES#O, all content notifications must be backed by a valid ContentProvider.

Java documentation for android.content.ContentResolver.registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver).

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

See also