K
K
kirvel2021-01-05 17:07:26
Android
kirvel, 2021-01-05 17:07:26

DataBinding not working in RecyclerViewAdapter(Android, Kotlin)?

Here is the code for the OnBindViewHolder function:

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    val country = countries[position]
    var countryInfoCardBinding = DataBindingUtil.setContentView<CountryInfoCardBinding>(context as Activity, R.layout.country_info_card)
    countryInfoCardBinding.country = country
}

And here is the XML file:
https://pastebin.com/PySQFLmv

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question