title: Cannot resolve ViewModelProvider construction in a fragment?
body: <p>I have been spending a lot of time trying to figure out why in the code below (towards the end), I get an error on ViewModelProvider(this). I also tried getActivity() instead of 'this', same issue. The error I get is "Cannot resolve constructor ..."</p>
  
  <pre><code>
  import androidx.fragment.app.Fragment;
  import androidx.lifecycle.ViewModelProvider;
  
  
  
  public class ItemSetupFragment extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_setup, container, false);
  
          return view;
      }
  
      @Override
      public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
          ItemSetupFragmentModel model = new ViewModelProvider(this).get(ItemSetupFragmentModel.class);
          model.getKids().observe(this, users -&gt; {
              // update UI
          });
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/luLuj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/luLuj.png" alt="Image showing compilation error in Android Studio"></a></p>