# AbstractCursor.SelfContentObserver

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# SelfContentObserver

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/database/AbstractCursor.SelfContentObserver "View this page in Java")  

```
protected open class SelfContentObserver : ContentObserver
```

|---|---|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                |||
| ↳ | [android.database.ContentObserver](https://developer.android.com/reference/kotlin/android/database/ContentObserver)                                           ||
|   | ↳ | [android.database.AbstractCursor.SelfContentObserver](https://developer.android.com/reference/kotlin/android/database/AbstractCursor.SelfContentObserver#) |

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

## Summary

|                                                                                                                                            Public constructors                                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [SelfContentObserver](https://developer.android.com/reference/kotlin/android/database/AbstractCursor.SelfContentObserver#SelfContentObserver(android.database.AbstractCursor))`(`cursor:` `[AbstractCursor](https://developer.android.com/reference/kotlin/android/database/AbstractCursor)!`)` <br /> |

|                                                                                                                                                                Public methods                                                                                                                                                                ||
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [deliverSelfNotifications](https://developer.android.com/reference/kotlin/android/database/AbstractCursor.SelfContentObserver#deliverSelfNotifications())`()` <br />                                                                                 |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [onChange](https://developer.android.com/reference/kotlin/android/database/AbstractCursor.SelfContentObserver#onChange(kotlin.Boolean))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> |

| Inherited functions ||
|---|---|
| From class[ContentObserver](https://developer.android.com/reference/kotlin/android/database/ContentObserver) |------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [dispatchChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#dispatchChange(kotlin.Boolean))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Dispatches a change notification to the observer. If a[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)was supplied to the[ContentObserver](https://developer.android.com/reference/kotlin/android/database/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. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [dispatchChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#dispatchChange(kotlin.Boolean,%20android.net.Uri))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)?`)` <br /> Dispatches a change notification to the observer. Includes the changed content Uri when available. If a[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)was supplied to the[ContentObserver](https://developer.android.com/reference/kotlin/android/database/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. <br />                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [dispatchChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#dispatchChange(kotlin.Boolean,%20android.net.Uri,%20kotlin.Int))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)?`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Dispatches a change notification to the observer. Includes the changed content Uri when available. If a[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)was supplied to the[ContentObserver](https://developer.android.com/reference/kotlin/android/database/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. <br />                                                                                                                                                                                                                                                                                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [dispatchChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#dispatchChange(kotlin.Boolean,%20kotlin.collections.MutableCollection,%20kotlin.Int))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uris:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!>`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Dispatches a change notification to the observer. Includes the changed content Uris when available. If a[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)was supplied to the[ContentObserver](https://developer.android.com/reference/kotlin/android/database/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. <br />                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#onChange(kotlin.Boolean,%20android.net.Uri))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)?`)` <br /> 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: ```kotlin <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> ``` <br /> <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#onChange(kotlin.Boolean,%20android.net.Uri,%20kotlin.Int))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)?`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> 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. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onChange](https://developer.android.com/reference/kotlin/android/database/ContentObserver#onChange(kotlin.Boolean,%20kotlin.collections.MutableCollection,%20kotlin.Int))`(`selfChange:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, `uris:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!>`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> 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. <br />                                                                                                                                                                                                                                                                                                                        | ||

## Public constructors

### SelfContentObserver

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
SelfContentObserver(cursor: AbstractCursor!)
```

## Public methods

### deliverSelfNotifications

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun deliverSelfNotifications(): Boolean
```

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if self-change notifications should be delivered to the observer. |

### onChange

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onChange(selfChange: Boolean): Unit
```

|                                                                  Parameters                                                                  ||
|--------------|--------------------------------------------------------------------------------------------------------------------------------|
| `selfChange` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):True if this is a self-change notification. |