title: Incompatible types error with Fragments
body: <p>I'm trying to add a fragment to my main activity. When I type <code>fragment = new CrimeFragment();</code> I get an <code>Incompatible types</code> error. </p>
  
  <p>I tried casting <code>new CrimeFragment();</code> to a <code>Fragment</code>, but that didn't work. </p>
  
  <pre><code>package com.adamanteusstudios.officesmostwanted;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentManager;
  
  
  public class MostWantedActivity extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_most_wanted);
  
          //getting fragmentManager
          FragmentManager fm = getSupportFragmentManager();
          Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);
  
          if(fragment == null){
              ***fragment =  new OffenseFragment();***
              fm.beginTransaction().add(R.id.fragmentContainer, fragment).commit();
          }
      }
  
  
  
  }
  </code></pre>
  
  <p>The error says:</p>
  
  <blockquote>
    <p>incompatible types<br>
    required: android.v4.support.app.Fragment<br>
    found: com.adamanteusstudios.officesmostwanted.OffenseFragment</p>
  </blockquote>
  
  <p>How do I fix this error?</p>