Search code examples
androidandroid-cursoradaptercontentobserver

Android: how to unregister the ContentObserver and DataSetObserver of a CursorAdapter


I found there is no interface in side CursorAdapter to unregister the ContentObserver and DataSetObserver it apply. I can only use Cursor.getCursor().close() to close the cursor but cannot unregister its observers.


Solution

  • Calling CursorAdapter.changeCursor(null) will unregister all the observers and close the cursor.