I use several lists, each of which uses subclasses of SimpleCursorAdapter to process the results from db. This is a simple diary, activity 1 = day, activity 2 = week.
I am trying to remove an item in the day view and then update the day and week view after the change.
If I call cursor.requery () on the operation I deleted, it reflects the change. However, other activities are not aware of the changes.
I think I want to use Cursor.registerContentObserver as the document requirement "Register an observer that is called when changes occur with content that supports this cursor. Typically, the data set does not change until the query () is called.
However, I naively wrote a content observer:
private class dbObserver extends ContentObserver {
public dbObserver(Handler handler) {
super(handler);
}
@Override
public void onChange(boolean selfChange) {
lectureCursor.requery();
super.onChange(selfChange);
}
}
onCreate :
dbObserver test = new dbObserver(new Handler());
lectureCursor.registerContentObserver(test);
onChange , . - ?