I am facing a weird issue here.
In my app, the user needs to restart the loader after updating some preferences onLoadFinished
, all fine here, the thing is that is I set mAdapter.notifyDataSetChanged();
it scrolls all the way to the bottom of the list.
The weird part is that it only happens once, the first time you restart the loader. All the other times the view remains exactly where it is.
I am notifying the change on UI thread...
getLoaderManager().initLoader(EXISTING_EVAL_LOADER, null, ViewActivity.this);
runOnUiThread(new Runnable() {
public void run() {
mAdapter.notifyDataSetChanged();
}
});
If I don't call notifyDataSetChanged();
the app crashes only on list item click and I get:
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes.