When convertView
is null
, it means that there is no view in recycling, therefore we must create a new one. Your Holder
has 2 visual attributes ImageView
and% TextView
. The function of the adapter itself is to reuse views. Therefore, once an item of your list is loaded, it is not necessary to define this view again, but it is already recycled and it is enough to set the values of your different items. Your code evaluates that it is not null
, if it is null
you define this format of view so that the other items load it, if it is different from null
, only you take the one that you created previously with getTag()
.
The error is in the else
where you do
holder = (BandasHolder) row.setTag();
Change to:
holder = (BandasHolder) row.getTag();