I have searched between many notifyDataSetChanged() issue questions without finding my specific case, so here it is:
Problem
I have a root thread (started by the UI thread) that listen for something. Everytime it receives a message, it starts a new thread (let's call them children threads) that does some operations and, at the end of its life, notifies to the UI adapter that an object has been added.
This procedure works 99.99% of the time (I have stressed a lot the program) but in some cases that I cannot understand this notification does not work.
I am sure that the problem is the listview because the two above statements (setImageBitmap) work properly, changing the imageViews images.
Code
The following code is called by the children threads.
Here it is the code that generates the issue:
mHandler.post(new Runnable() {
@Override
public void run() {
mLastPlateImage.setImageBitmap(plateImage);
mLastContextImage.setImageBitmap(contextImageResized);
mPlateInfoList.add(0, plateInfo);
// That is the problem
mPlateListAdapter.notifyDataSetChanged();
System.gc();
}
});
0 comments:
Post a Comment