I have a problem with the bootloader.
I have an Activity that displays a list of records retrieved from a local database. When the action begins, entries are automatically loaded using the LoaderManager.initLoader () method.
It is also possible to manually update the list using the refresh button in ActionBarSherlock. However, after completing another action that adds a record to the database, onLoadFinished is not called.
I am using SimpleCursorLoader and here is the code snippet from this operation:
@Override
public void onStart() {
...
getSupportLoaderManager().initLoader(0, null, this);
}
@Override
public void onPause() {
...
getSupportLoaderManager().destroyLoader(0);
}
public void refreshRecords() {
getSupportLoaderManager().restartLoader(0, null, this);
}
@Override
public Loader<Cursor> onCreateLoader(int id, final Bundle args) {
Loader<Cursor> l = new SimpleCursorLoader(this) {
@Override
public Cursor loadInBackground() {
return recordDAO.getCursor();
}
};
l.forceLoad();
return l;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
The problem is that after the completion of another action is called onLoaderCreate, but onLoaderFinishednot called.
after some debugging, I found what is also called the SimpleCursorAdapter.deliverResults()bud ends on.. if (isReset()) { ..
- ? ?