Listing 9.11 can't resolve type mismatch


#1

I can’t seem to get the CrimeListFragment() to resolve. Sure I’m missing something simple but can’t find it.

Code for CrimeListActivity.java

[code]package com.android.criminalintent;

import android.support.v4.app.Fragment;

public class CrimeListActivity extends SingleFragmentActivity {

@Override
protected Fragment createFragment() {
	return new CrimeListFragment();	
}

}[/code]

It’s the “new CrimeListFragment()” that is underlined and says “Type mismatch: cannot convert from CrimeListFragment to Fragment”

Thanks for any help or suggestions.
Toby

code for CrimeListFragment.java

[code]package com.android.criminalintent;

import java.util.ArrayList;

import android.app.ListFragment;
import android.os.Bundle;

public class CrimeListFragment extends ListFragment {

private ArrayList<Crime> mCrimes;

@Override
public void onCreate(Bundle savedInstanceState)  {
	super.onCreate(savedInstanceState);
	getActivity().setTitle(R.string.crimes_title);
	mCrimes = CrimeLab.get(getActivity()).getCrimes();
}

}[/code]


#2

Try changing the import in CrimeListFragment to this:


#3

Thanks! that did it.