title: Android ViewModel LiveData Documentation
body: <p>I read the documentation but became confuse on some part.</p>
  <blockquote>
  <p>ViewModel objects are designed to outlive specific instantiations of views or LifecycleOwners. This design also means you can write tests to cover a ViewModel more easily as it doesn't know about view and Lifecycle objects. ViewModel objects can contain LifecycleObservers, such as LiveData objects. However ViewModel objects must never observe changes to lifecycle-aware observables, such as LiveData objects. If the ViewModel needs the Application context, for example to find a system service, it can extend the AndroidViewModel class and have a constructor that receives the Application in the constructor, since Application class extends Context.</p>
  </blockquote>
  <p>This part is somewhat confusing for me</p>
  <blockquote>
  <p>However ViewModel objects must never observe changes to lifecycle-aware observables, such as LiveData objects.</p>
  </blockquote>
  <p>Is this referring to this kind of implementation?</p>
  <p>Fragment</p>
  <pre><code>class AboutFragment : Fragment() {
  
      private lateinit var aboutViewModel: AboutViewModel
      private var _binding: FragmentAboutBinding? = null
  
      // This property is only valid between onCreateView and
      // onDestroyView.
      private val binding get() = _binding!!
  
      override fun onCreateView(
              inflater: LayoutInflater,
              container: ViewGroup?,
              savedInstanceState: Bundle?
      ): View {
          aboutViewModel =
                  ViewModelProvider(this).get(AboutViewModel::class.java)
  
          _binding = FragmentAboutBinding.inflate(inflater, container, false)
          val root: View = binding.root
  
          val textView = binding.aboutTxt
  
          //Observe changes
          aboutViewModel.text.observe(viewLifecycleOwner, {
              textView.text = it
          })
          return root
      }
  
      override fun onDestroyView() {
          super.onDestroyView()
          _binding = null
      }
  }
  </code></pre>
  <p>ViewModel</p>
  <pre><code>class AboutViewModel : ViewModel() {
  
  private val _text = MutableLiveData&lt;String&gt;().apply {
      value = &quot;Foobar......&quot;
             
  }
  
  fun setText(text: String){ _text.value = text}
  
  val text: LiveData&lt;String&gt; = _text
  </code></pre>
  <p>}</p>
  <p>Or this is what they mean <code>LiveData&lt;LiveData&lt;Object&gt;&gt;</code> not to do?</p>