Incompatible types error for fragment


Hi I am getting this error in my on the line

fragment = new CrimeFragment();

Incompatible types.

Could someone explain to me how would I resolve this type of error and what exactly is going on?

[code]public class CrimeActivity extends FragmentActivity {

protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_crime); fm = getSupportFragmentManager();
    Fragment fragment = fm.findFragmentById(;

    if (fragment == null){
        fragment = new CrimeFragment();
                .add(, fragment)



I am not sure why you have fm = getSupportFragmentManager();.
I have FragmentManager fm = getSupportFragmentManager();


I had the same incompatibility error and this is what worked for me:

import; fm = getSupportFragmentManager(); fragment = fm.findFragmentById(;

Although this post is a over a year old, this error may still be a problem with the new versions of Eclipse.