title: RecyclerView inside RecyclerView in kotlin
body: <pre><code>package com.example.expensemanager.ui.monthlyCards
  
  import android.app.Activity
  import android.content.Context
  import android.content.SharedPreferences
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.widget.Toast
  import androidx.fragment.app.FragmentActivity
  import androidx.lifecycle.LifecycleOwner
  import androidx.lifecycle.Observer
  import androidx.recyclerview.widget.DiffUtil
  import androidx.recyclerview.widget.LinearLayoutManager
  import androidx.recyclerview.widget.ListAdapter
  import androidx.recyclerview.widget.RecyclerView
  import com.example.expensemanager.R
  import com.example.expensemanager.ui.TransactionAdapter
  import kotlinx.android.extensions.LayoutContainer
  import kotlinx.android.synthetic.main.fragment_monthly_cards.*
  import kotlinx.android.synthetic.main.monthly_card_item.*
  
  class MonthCardsAdapter(private val listener: (Long) -&gt; Unit ,val sharedPreferences: SharedPreferences , val activity:FragmentActivity?, val viewModel: MonthlyCardsViewModel,val lifecycleOwner: LifecycleOwner):
      ListAdapter&lt;Long, MonthCardsAdapter.ViewHolder&gt;(
          DiffCallback1()
      ){
      override fun onCreateViewHolder(parent: ViewGroup,
                                      viewType: Int): ViewHolder {
          val itemLayout = LayoutInflater.from(parent.context)
              .inflate(R.layout.monthly_card_item, parent, false)
  
          return ViewHolder(itemLayout)
      }
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
          holder.bind(getItem(position))
      }
  
      inner class ViewHolder (override val containerView: View) : RecyclerView.ViewHolder(containerView),
          LayoutContainer {
          init{
              itemView.setOnClickListener{
                  listener.invoke(getItem(adapterPosition))
              }
          }
  
          fun bind(monthYear: Long){
              month_name.text = monthYear.toString()
              year_name.text = &quot;2001&quot;
              val monthlyBudget = sharedPreferences.getFloat(&quot;monthlyBudget&quot;,0F)
              monthly_budget.text = monthlyBudget.toString()
  
              child_recycler_view.apply {
                  layoutManager = LinearLayoutManager(activity)
                  adapter = TransactionAdapter({})
              }
              viewModel.transactionMonth.observe(lifecycleOwner, Observer {
                  (child_recycler_view.adapter as TransactionAdapter).submitList(it)
              })
          }
      }
  }
  class DiffCallback1 : DiffUtil.ItemCallback&lt;Long&gt;() {
      override fun areItemsTheSame(oldItem: Long, newItem: Long): Boolean {
          return oldItem == newItem
      }
  
      override fun areContentsTheSame(oldItem: Long, newItem: Long): Boolean {
          return oldItem == newItem
      }
  }
  </code></pre>
  <p>This is the adapter of my parent Recycler View in which I am taking lifeCycleOwner as a parameter in the constructor and then setting adapter of child recycler view in the bindViewHolder. The problem is that the child recycler view is not being shown. According to me, the mistake is in the lifeCycleOwner but still, I couldn't rectify the issue.</p>