I am using my BaseAdapter (standingsListAdapter) for ListView (standingsLV) . When I install the adapter:
standingsLV.setAdapter(standingsListAdapter);
getViewTypeCount() . But later, when I install new data in the adapter:
standingsListAdapter.setData(data);
where setData(data) after setting new data calls notifyDataSetChanged() :
public void setData(StandingsModelWrapper data) { groupsData.clear(); if (data != null) { groupsData.addAll(data.getModel()); } notifyDataSetChanged(); }
The getViewTypeCount () method is not called again. What for? How to make the adapter check getViewTypeCount () again?
Why do I need it?
- I show tables in each line of the list. Tables have different lengths (number of rows).
- I want to install new data in the adapter, so the length of the tables may change.
That's why the number of my view types should be recounted every time new data arrives in the list adapter.
source share