title: Use ViewModelFactory inside Fragment
body: <p>I'm trying to share a ViewModel between my activity and my fragment. My ViewModel contains a <code>report</code>, which is a complex object I cannot serialize.</p>
  
  <pre><code>    protected val viewModel: ReportViewModel by lazy {
          val report = ...
          ViewModelProviders.of(this, ReportViewModelFactory(report)).get(ReportViewModel::class.java)
      }
  </code></pre>
  
  <p>Now I'm trying to access the viewmodel in a fragment, but I don't want to pass all the factory parameters again.</p>
  
  <p>As stated by the <code>ViewModelProvider.get</code> documentation:</p>
  
  <blockquote>
    <p>Returns an existing ViewModel or creates a new one in the scope</p>
  </blockquote>
  
  <p>I want to access the ViewModel instance defined in the activity, so I tried the following but it logically crashes as the model doesn't have an empty constructor:</p>
  
  <pre><code>protected val viewModel: ReportViewModel by lazy {
      ViewModelProviders.of(requireActivity()).get(ReportViewModel::class.java)
  }
  </code></pre>
  
  <p>How one should access its "factorysed" ViewModels in a fragment? Should we pass the factory to the fragment?</p>
  
  <p>Thanks!</p>