I'm using LoaderManager.LoaderCallbacks<Cursor> in my FragmentActivity.
I invoke in onResume():
getSupportLoaderManager().restartLoader(0, null, loader);
I invoke in onCreate():
loader = new ApplicationLoader();
getSupportLoaderManager().initLoader(0, null, loader);
Finally I have:
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Deleting row from database
}
});
But my list does not refresh its items.
Only way to work is invoke:
loader = new ApplicationLoader();
getSupportLoaderManager().restartLoader(0, null, loader);
I was having a similar problem. I had forgotten to call:
getContext().getContentResolver().notifyChange(uri, null);
After insert, update, and delete. Also, do not close any cursors. The loader does that for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With