I have a ListView on my Android application that I dynamically change the data of. I use the onFilterComplete()
method to change the contents of the ListView.
Pre Ice Cream Sandwhich the following code works fine:
if(adapter != null) {
adapter.notifyDataSetInvalidated();
lview3.invalidateViews();
adapter.getFilter().filter(aa1.getItem(item), new Filter.FilterListener() {
public void onFilterComplete(int count) {
adapter.notifyDataSetChanged();
if(lview3.getCount() == 0){
lview3.setVisibility(View.GONE);
}
else{
lview3.setVisibility(View.VISIBLE);
}
}});
However on Ice Cream Sandwhich when I use the filter the screen doesn't get refreshed properly, If the filter returns a number of entries that is smaller than the previous ListView then the old list data appears to be still visible in the background, as per this screen shot:
From the screen shot you can see where the first entry in the ListView is, this is all that should be visible, you can see where the previous results are still visible underneath, these are just visible they are not functional as in they can't be tapped, it's as if the screen hasn't properly refreshed.
When I select the home button to leave the application via the home screen and return everything appears as it should as in the following screen shot:
Is there something else I have to implement to properly refresh the ListView on Ice Cream Sandwhich? Has anyone else encountered a similar issue?
What I have works fine pre ICS.