title: RecyclerView not showing data on first load
body: <p>I am trying to load a list of data from local db using LiveData.</p>
  
  <p>view.xml</p>
  
  <pre><code>... // constraint layout surrounds this
  &lt;androidx.recyclerview.widget.RecyclerView
              android:id="@+id/recyclerView_cities"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp" /&gt;
  </code></pre>
  
  <p>here is how I am setting up the recycler view in the Fragment:</p>
  
  <pre><code>val citiesAdapter = CitiesAdapter(cityRepository)
  with(view.recyclerView_cities) {
      layoutManager = LinearLayoutManager(activity)
      setHasFixedSize(true)
      adapter = citiesAdapter
  }
  cityRepository.getAllCities().observe(this, Observer { list -&gt;
      citiesAdapter.submitList(list)
  })
  </code></pre>
  
  <p>adapter:</p>
  
  <pre><code>class CitiesAdapter(private val repository: CityRepository) : ListAdapter&lt;City, CitiesAdapter.CardViewHolder&gt;(CityCallback()) {
      class CityCallback: DiffUtil.ItemCallback&lt;City&gt;() {
          override fun areItemsTheSame(oldItem: City, newItem: City): Boolean {
              return oldItem.city == newItem.city &amp;&amp; oldItem.stateId == newItem.stateId
          }
  
          override fun areContentsTheSame(oldItem: City, newItem: City): Boolean {
              return oldItem.city == newItem.city &amp;&amp;
                      oldItem.stateName == newItem.stateName &amp;&amp;
                      oldItem.stateId == newItem.stateId &amp;&amp;
                      oldItem.selected == newItem.selected
          }
      }
  
      fun getCityAt(position: Int): City = getItem(position)
  
      // Provide a reference to the views for each data item
      class CardViewHolder(cardView: CardView) : RecyclerView.ViewHolder(cardView) {
          lateinit var checkBox: CheckBox
      }
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewHolder {
          ...
      }
  
      override fun onBindViewHolder(holder: CardViewHolder, position: Int) {
          ...
      }
  }
  </code></pre>
  
  <p><code>cityRepository.getAllCities()</code> returns a LiveData> from my database.</p>
  
  <p>I am using the ListAdapter that extends from RecyclerView so that it can handle managing the list for me. Also I am using the DiffUtil so that more granular notifies are called instead of just using notifyDataSetChanged.</p>
  
  <p>Expected Behavior:
  When I load the fragment, a list is shown in a RecyclerView with all of the cities in the database.</p>
  
  <p>Actual Behavior:
  When I load the fragment, an empty list is shown even though there are cities in the database. if I add a new city from the fragment, the list is populated with everything that was there before and the newly added item.</p>
  
  <p>EDIT:
  I hacked in an EditText to the xml and the list populates when I click it from the emulator. It does not work when I try and click it programmatically.</p>