0

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?

JITHIN GOPAL
  • 121
  • 1
  • 13

1 Answers1

1
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.

Blackbelt
  • 152,872
  • 27
  • 286
  • 297