title: Android Kotlin RecyclerView in Fragment is not working
body: <p>I'm very new in Kotlin and Android programming. I tried to create a Fragment which populates a Recycler view, but somehow I get the following error: <code>E/RecyclerView: No adapter attached; skipping layout</code>
  I don't really understand why I get this, since I binded everything. If somebody can explain what I'm doing wrong I would really appreciate it. My code is the following:</p>
  <p>My class:</p>
  <pre><code>data class Movie(val id:Int, val posterPath:String, val vote:Double, val language:String,val releaseDate:String, val title:String) {}
  </code></pre>
  <p>My fragment:</p>
  <pre><code>class MovelistScreen : Fragment(R.layout.fragment_movelist_screen) {
  
      @ExperimentalStdlibApi
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
  
  // View created, can be accessed
  //        val args = arguments ?: throw IllegalArgumentException(&quot;Use new instance method&quot;)
  //        val argValue = args.getString(ARG_NAME)
  
          val binding = FragmentMovelistScreenBinding.inflate(layoutInflater)
          val lst : List&lt;Movie&gt; = buildList {
              add(Movie(id=1,posterPath=&quot;/asdasd&quot;,vote=7.3,language=&quot;Eng&quot;,releaseDate=&quot;2017&quot;,title=&quot;Test1&quot;))
              add(Movie(id=2,posterPath=&quot;/asdasd&quot;,vote=6.3,language=&quot;Hun&quot;,releaseDate=&quot;2013&quot;,title=&quot;Test2&quot;))
          }
  
          val listAdapter = MovieListAdapter()
          binding.itemList.adapter=listAdapter
          listAdapter.submitList(lst)
      }
      companion object {
          private const val ARG_NAME = &quot;test_argument&quot;
          fun newInstance(testArg: String): DetailpageFragment = DetailpageFragment().apply {
              arguments = Bundle().apply { putString(ARG_NAME, testArg) }
          }
      }
  }
  </code></pre>
  <p>My adapter</p>
  <pre><code>class MovieListAdapter : ListAdapter&lt;Movie, MovieViewHolder&gt;(diffUtil) {
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder {
          val layoutInflater: LayoutInflater = LayoutInflater.from(parent.context)
          return MovieViewHolder(MovieItemBinding.inflate(layoutInflater,parent,false))
      }
  
      override fun onBindViewHolder(holder: MovieViewHolder, position: Int) {
          val item:Movie=getItem(position)
          val binding:MovieItemBinding = holder.binding
  
          binding.movieTitle.text=item.title
          binding.releaseYear.text=item.releaseDate
          binding.language.text=item.language
          binding.ratingtext.text=item.vote.toString()
          binding.movieImage.load(&quot;https://i.postimg.cc/VLbN4hkz/the-hobbit-the-desolation-of-smaug.jpg&quot;)
      }
  }
  
  
  private val diffUtil : DiffUtil.ItemCallback&lt;Movie&gt; = object : DiffUtil.ItemCallback&lt;Movie&gt;() {
      override fun areItemsTheSame(oldItem: Movie, newItem: Movie): Boolean = oldItem.id == newItem.id
      override fun areContentsTheSame(oldItem: Movie, newItem: Movie): Boolean = oldItem == newItem
  }
  
  class MovieViewHolder(val binding: MovieItemBinding):RecyclerView.ViewHolder(binding.root)
  </code></pre>
  <p>fragment_movelist_screen.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_height=&quot;match_parent&quot;
      android:layout_width=&quot;match_parent&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;
  
      &lt;androidx.recyclerview.widget.RecyclerView
          android:id=&quot;@+id/item_list&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          app:layoutManager=&quot;androidx.recyclerview.widget.LinearLayoutManager&quot;
          android:orientation=&quot;vertical&quot;
          android:padding=&quot;16dp&quot;&gt;
      &lt;/androidx.recyclerview.widget.RecyclerView&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>mainactivity.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;fragment
          android:id=&quot;@+id/fragmentmovielist&quot;
          android:name=&quot;com.example.ubbassignment2.MovelistScreen&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:layout=&quot;@layout/fragment_detailpage&quot; /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>