I have a list Fragment (importing the v4 support library, build target is 2.3.3 api 11)
and the following problem in my code that was working fine when the target was 3.0 and I didn’t use the library.
Fragment frag1 = new ExampleFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.contentframe, frag1);
ft.commit();
Now I’m getting the compile error that
"Type mismatch: cannot convert from ExampleFragment to Fragment"
and it tells me to change the “Fragment” to ExampleFragment (e.g.)
ExamplesFragment frag1 = new ExamplesFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.contentframe, frag1);
ft.commit();
Then I have a problem that the ft.replace command has an error:
The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, Fragment_PVAnn)
and it tells me to change the ExamplesFragment in the first line back to just Fragment and so the circle goes round and around
You should use
If that is still giving you problems, then makre sure that your
Activity extends FragmentActivity.If that is still giving you problems,
support.v4.*, notandroid.*.