title: Force LiveData Observer inside a Fragment to receive a change after coming visible again?
body: <p>I am implementing <code>Android Architecture Components</code>. Imagine a case like the following where your <code>Fragment</code> is observing a <code>LiveData</code> to change its UI. User minimizes the app and the state is changed (in my case from the repository). So the <code>Observer</code> from the <code>Fragment</code> is not triggered with a change because the <code>Fragment</code> is not visible. But then, when the user comes back to the app it doesn't trigger the new state. If the state is changed again (while the <code>Fragment</code> is visible), the <code>Observer</code> receives the change. Do you know any way to force an update when fragment is visible again?</p>
  
  <pre><code>override fun onActivityCreated(savedInstanceState: Bundle?) {
      super.onActivityCreated(savedInstanceState)
  
      vm = ViewModelProviders.of(this, viewModelFactory).get(MyViewModel::class.java)
      vm.getStatus()?.observe(this, Observer&lt;MyRepository.Status&gt; { status -&gt;
          if (status != null) {
              when (status) {
                  NONE -&gt; setNoneUI()
                  LOADING -&gt; setLoadingUI()
                  CONTENT -&gt; setContentUI()
                  ERROR -&gt; setErrorUI()
              }
          }
      })
  }
  </code></pre>