should I always use convertView as my main ViewElement in Base adapter?

61 views Asked by At

the variable convertView in getView of BaseAdapter . What is it for? when creating items should I always use convertView? What is the problem if I don't use it?

1

There are 1 answers

0
Blackbelt On BEST ANSWER
What is it for? 

it an instance of the View if you inflate, the first time its value is null. E.g.

 if (convertView == null) {
      convertView = inflate...
 }

when creating items should I always use convertView?

yes, but try to implement the ViewHolder pattern around it. It will speed up the scroll's performance.

What is the problem if I don't use it?

it depends on the the number of items you have in your ListView. We can go from laggy ux to crashes.