title: Implement binding into RecycleView Adapter Android Kotlin
body: <p>So hello, I have a little problem here.</p>
  <p>I can't implement my binding properly into adapter for RecycleView. I need it to display my products in cart as you can see in the code below. I am a beginner with adapter, so please help me.</p>
  <p>CartItemsListAdapter.kt *here is where I want to implement binding*</p>
  <pre><code>class CartItemsListAdapter(
  private val context: Context,
  private var list: ArrayList&lt;CartItem&gt;
  ) : RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt;(){
  
  
  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): 
  RecyclerView.ViewHolder {
      return MyViewHolder(
          LayoutInflater.from(context).inflate(
              R.layout.item_cart_layout,
              parent,
              false
          )
      )
  }
  
  override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
      val model = list[position]
      if (holder is MyViewHolder) {
          Glide.with(context)
              .load(model.image)
              .placeholder(R.drawable.ic_launcher)
              .into(/*binding.ivCartItemImage*/)
          //binding.tvCartItemPrice.text = model.price
          //binding.tvCartItemTitle.text = model.title
      }
  }
  
  override fun getItemCount(): Int {
      return list.size
  }
  
  private class MyViewHolder(view: View) : RecyclerView.ViewHolder(view)
  }
  </code></pre>
  <p>activity_cart_list.xml *xml file for reference and from where I want to take those bindings*</p>
  <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout 
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  tools:context=&quot;.ui.activities.CartListActivity&quot;&gt;
  
  &lt;androidx.appcompat.widget.Toolbar
      android:id=&quot;@+id/toolbar_cart_list_activity&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;?attr/actionBarSize&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      android:background=&quot;?attr/colorSecondary&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/arrow_back&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:background=&quot;@drawable/ic_arrow_left&quot;
          android:hapticFeedbackEnabled=&quot;true&quot;
          android:layout_marginTop=&quot;16sp&quot;
          android:padding=&quot;24dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          android:layout_gravity=&quot;top&quot;
          android:contentDescription=&quot;@string/back_button&quot; /&gt;
  
      &lt;com.example.trieskask.utils.OswaldBold
          android:id=&quot;@+id/tv_title&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:text=&quot;My cart&quot;
          android:textSize=&quot;26sp&quot;
          android:elevation=&quot;3dp&quot;
          android:textStyle=&quot;bold&quot; /&gt;
  
  &lt;/androidx.appcompat.widget.Toolbar&gt;
  
  &lt;androidx.recyclerview.widget.RecyclerView
      android:id=&quot;@+id/rv_cart_items_list&quot;
      android:layout_width=&quot;0dp&quot;
      android:layout_height=&quot;0dp&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:visibility=&quot;gone&quot;
      app:layout_constraintBottom_toTopOf=&quot;@id/ll_checkout&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toBottomOf=&quot;@id/toolbar_cart_list_activity&quot; /&gt;
  
  &lt;com.example.trieskask.utils.OswaldRegular
      android:id=&quot;@+id/tv_no_cart_item_found&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_marginStart=&quot;8dp&quot;
      android:layout_marginTop=&quot;8dp&quot;
      android:layout_marginEnd=&quot;8dp&quot;
      android:text=&quot;No cart item found!&quot;
      android:textAlignment=&quot;center&quot;
      app:layout_constraintBottom_toTopOf=&quot;@id/ll_checkout&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toBottomOf=&quot;@id/toolbar_cart_list_activity&quot; /&gt;
  
  &lt;LinearLayout
      android:id=&quot;@+id/ll_checkout&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:background=&quot;?attr/colorSecondary&quot;
      android:elevation=&quot;4dp&quot;
      android:orientation=&quot;vertical&quot;
      android:padding=&quot;16dp&quot;
      android:visibility=&quot;gone&quot;
      tools:visibility=&quot;visible&quot;
      app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;horizontal&quot;&gt;
  
          &lt;com.example.trieskask.utils.OswaldLight
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:text=&quot;Subtotal:&quot; /&gt;
  
          &lt;com.example.trieskask.utils.OswaldLight
              android:id=&quot;@+id/tv_sub_total&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:textAlignment=&quot;center&quot;
              tools:text=&quot;$100&quot; /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;horizontal&quot;&gt;
  
          &lt;com.example.trieskask.utils.OswaldLight
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:text=&quot;Shipping charge:&quot; /&gt;
  
          &lt;com.example.trieskask.utils.OswaldLight
              android:id=&quot;@+id/tv_shipping_charge&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:textAlignment=&quot;center&quot;
              tools:text=&quot;$10&quot; /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;horizontal&quot;&gt;
  
          &lt;com.example.trieskask.utils.OswaldBold
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:text=&quot;Total Amount&quot; /&gt;
  
          &lt;com.example.trieskask.utils.OswaldBold
              android:id=&quot;@+id/tv_total_amount&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:textAlignment=&quot;center&quot;
              tools:text=&quot;$110&quot; /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;com.example.trieskask.utils.OswaldButton
          android:id=&quot;@+id/btn_checkout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_gravity=&quot;center&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:layout_marginTop=&quot;30dp&quot;
          android:layout_marginEnd=&quot;16dp&quot;
          android:background=&quot;@drawable/btn_ripple_effect&quot;
          android:foreground=&quot;?attr/selectableItemBackground&quot;
          android:gravity=&quot;center&quot;
          android:text=&quot;Checkoutt&quot;
          android:textColor=&quot;@android:color/white&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot; /&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>Thanks for any kind of help</p>