Skip to content Skip to sidebar Skip to footer

Getitemviewtype Position Always 0

I have a class that extends BaseAdaptor and overrides the getItemViewType(int position) function. When I swap the cursor or notify the data set change, the value being passed in fo

Solution 1:

Probably because getTypeCount returns "1" - so there's no need to actually iterate through "position" - Android assumes all view types are the same.

You should probably Override that method:

publicintgetViewTypeCount() {
    return1;
}

But first, be sure that you know what it does. It's only useful if you have different types of data, not different values. See this post:

getViewTypeCount and getItemViewType methods of ArrayAdapter

Solution 2:

The issue here was that my ListView's height was too small, so only the first row was ever getting rendered because the others were not visible.

Post a Comment for "Getitemviewtype Position Always 0"