title: What ViewModelStoreOwner to use for ViewModelProvider in Fragment?
body: <p>I've creating a test activity that updates some text in my MyViewModel.</p>
  
  <p>I'd like to observe these changes in a <strong>Fragment</strong>, but when I use</p>
  
  <pre><code>MyViewModel myViewModel = new ViewModelProvider(this).get(MyViewModel.class);
  </code></pre>
  
  <p>it gives me a different instance of MyViewModel than that used in the activity, which results in my <code>onChanged()</code> callback in the fragment not being called.</p>
  
  <p>Only when I modify that same fragment code to</p>
  
  <pre><code>HomeViewModel homeViewModel = new ViewModelProvider(getActivity()).get(HomeViewModel.class);
  </code></pre>
  
  <p>does the fragment get the same instance of MyViewModel as the activity - so <code>onChanged()</code> is successfully called.</p>
  
  <p>However, I'm not sure if using <code>getActivity()</code> as the ViewModelStoreOwner is the proper way of doing things as I haven't seen this in any examples anywhere. I'm wondering if there might be a better ViewModelStoreOwner I should be using in this instance?</p>