My ListView
is using an extension of BaseAdapter
, I can not get it to refresh properly. When I refresh, it appears that the old data draws on top of the new data, until a scroll event happens. The old rows draw on top of the new rows, but the old rows disappear when I start scrolling.
I have tried calling invalidateViews()
, notifyDataSetChanged()
, and notifyDataSetInvalidated()
. My code looks something like:
private void updateData()
{
List<DataItems> newList = getNewList();
MyAdapter adapter = new MyAdapter(getContext());
//my adapter holds an internal list of DataItems
adapter.setList(newList);
mList.setAdapter(adapter);
adapter.notifyDataSetChanged();
mList.invalidateViews();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…