title: How to use DataBinding in a ListView?
body: <p>I'm using databiding into a RecyclerView in my layout like below :</p>
  
  <pre><code>        &lt;androidx.recyclerview.widget.RecyclerView
              android:id="@+id/topup_list"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:items="@{viewModel.items}"
              tools:listitem="@layout/list_item_content" /&gt;
  </code></pre>
  
  <p>and the list and binding adapters like :</p>
  
  <pre><code>@BindingAdapter("app:items")
  fun setItems(listView: RecyclerView, items: List&lt;ListItem&gt;?) {
      items?.let {
          (listView.adapter as MyListAdapter).submitList(items)
      }
  }
  
  //------------------
  
  class MyListAdapter() :
      ListAdapter&lt;ListItem, ViewHolder&gt;(myListItemDiffCallback()) {
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
          holder.bind(getItem(position))
      }
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
          return ViewHolder.from(parent)
      }
  
      class ViewHolder private constructor(private val binding: ListItemContentBinding) :
          RecyclerView.ViewHolder(binding.root) {
  
          fun bind(item: ListItem) {
  
              binding.item = item
              binding.executePendingBindings()
          }
  
          companion object {
  
              fun from(parent: ViewGroup): ViewHolder {
  
                  val layoutInflater = LayoutInflater.from(parent.context)
                  val binding = TopUpListItemContentBinding.inflate(layoutInflater, parent, false)
  
                  return ViewHolder(binding)
              }
          }
      }
  }
  
  class myListItemDiffCallback : DiffUtil.ItemCallback&lt;ListItem&gt;() {
  
      override fun areItemsTheSame(oldItem: ListItem, newItem: ListItem): Boolean {
          return oldItem.label == newItem.label
      }
  
      override fun areContentsTheSame(
          oldItem: ListItem,
          newItem: ListItem
      ): Boolean {
          return oldItem == newItem
      }
  }
  </code></pre>
  
  <p>But it's not the same case using a simple ListView. For many reasons, I prefer using a listview and I tried but I don't know how to customize my adapter for databiding like I used in RecycleView.</p>
  
  <p>Below is My adapter for Listview :</p>
  
  <pre><code>class MyListAdapter(context: Context, items: List&lt;ListItem&gt;) :
      ArrayAdapter&lt;ListItem&gt;(context, 0, items) {
  
      override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
  
          val binding = ListItemContentBinding.inflate(
              LayoutInflater.from(parent.context),
              parent,
              false
          )
  
          binding.item = getItem(position)
  
          return binding.root
      }
  }
  </code></pre>
  
  <p>My Item class Model :</p>
  
  <pre><code>data class ListItem(
      val iconResId: Int,
      val label: String,
      val action: () -&gt; Unit
  )
  </code></pre>
  
  <p>Any one has a clue ? </p>