title: Why can't I instantiate this Fragment on Android?
body: <p>Here is the code I have. I'm getting a red line under <code>new MainFragment();</code> with the error <code>Type mismatch: cannot convert from WishlistFragment to Fragment</code>:</p>
  
  <pre><code>Fragment newfragment = new MainFragment();   
  </code></pre>
  
  <p>Here is what my MainFragment.java file looks like:</p>
  
  <pre><code>public class MainFragment extends Fragment {
      public MainFragment() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
          return inflater.inflate(R.layout.fragment_main, container, false);
      }
  }
  </code></pre>
  
  <p>Any ides on why this is happening? I have a feeling it's something stupid I am looking over and I am just code-blind right now from a long day.</p>