I was working through a tutorial, and I am getting following warning in Android Studio: "Unconditional layout inflation from view adapter: Should use View Holder pattern (use recycled view passed into this method as the second parameter) for smoother scrolling." on inflater.inflate(R.layout.animal_ticket, null) line.
How do I fix this? this was never explained in the course, and I cannot figure it out on my own. Any help is very much appreciated!
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
val view : View = LayoutInflater.from(parent!!.context).inflate(R.layout.custom_layout,parent,false)
val animalName : TextView = view.findViewById(R.id.textView2)
val animalImage : ImageView = view.findViewById(R.id.imageView1)
animalName.text = nameList[position]
animalImage.setImageResource(imageList[position])
return view
}