A little bit late but I have faced exact same problem and comments were not well explanatory. For those who faces the problem here is the solution:
"Stop using FilterQueryProvider. CursorLoader is also a replacement for that: restart it with your filter and you'll be fine." (source)
Which means;
instead of doing this:
@Override
public Cursor runQuery(CharSequence listId) {
return mDb.getContacts(listId);
}// DO NOT set direct database query, has no observation at all.
or
@Override
public Cursor runQuery(CharSequence listId) {
return getContentManager.query(....,new String[]{listId}...
}// DO NOT return content manager result, forgets observers.
or
@Override
public Cursor runQuery(CharSequence listId) {
Bundle bundle = new Bundle();
bundle.putCharSequence("selected", listId);
getLoaderManager().restartLoader(CURSOR_LOADER_CONTACTS, bundle, MainActivity.this);
return null;
}// DO NOT restart the cursor loader with new info, screws observers.
with combination of mContactAdapter.getFilter().filter(id+"");
(while applying filter)
do this:
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case CURSOR_LOADER_CONTACTS:
long mListId = 0;
if (args != null) {
mListId = args.getLong(CONTACT_FILTER);
}
return new CursorLoader(this, ContentProvider.CONTACT_DISPLAY_URI, null, ContactTable.COLUMN_GROUP_ID+"=?", new String[]{id+""}, null);
} //Apply filter here with new info comes from 'restartLoader'
return null;
}
with combination of getLoaderManager().restartLoader(MainActivity.CURSOR_LOADER_CONTACTS, bundle, MainActivity.this);
assuming MainActivity.this
implements LoaderManager.LoaderCallbacks<Cursor>