I am trying to listen for any change in the contact database.
So I create my contentObserver which is a child class of ContentObserver:
private class MyContentObserver extends ContentObserver {
public MyContentObserver() {
super(null);
}
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
System.out.println (" Calling onChange" );
}
}
MyContentObserver contentObserver = new MyContentObserver();
context.getContentResolver().registerContentObserver (People.CONTENT_URI, true, contentObserver);
But When I use ‘EditContactActivity‘ to change the contact database, My onChange() does not get called.
I have deployed your example as it is and it works fine.
Something else must be wrong…
Are you making the changes through the cursor the observer is registered with?
Check that with the Observer function deliverSelfNotifications(). (it returns false by default)
You may want to override that observer function with something like: