I have an Android ListActivity that is backed by a database Cursor through a SimpleCursorAdapter.
When the items are clicked,
In case of using loader and automagically generated cursor you can call:
getLoaderManager().restartLoader(0, null, this);
in your activity, just after changing something on a DB, to regenerate new cursor. Don't forget to also have event handlers defined:
@Override
public Loader onCreateLoader(int id, Bundle args) {
CursorLoader cursorLoader =
new CursorLoader(this,
YOUR_URI,
YOUR_PROJECTION, null, null, null);
return cursorLoader;
}
@Override
public void onLoadFinished(Loader loader, Cursor data) {
adapter.swapCursor(data);
}
@Override
public void onLoaderReset(Loader loader) {
adapter.swapCursor(null);
}