I assume this is the error message you get:
The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, ItemDetailFragment) Change type of 'fragment' to 'Fragment'
Have you tried doing what the error message suggest you do?
ItemDetailFragment fragment = new ItemDetailFragment(); // This does not work
Fragment fragment = new ItemDetailFragment(); // This works!
If you at a later stage need to use methods exclusive to ItemDetailFragment
, you can always cast fragment
back to an ItemDetailFragment
-object. Like this:
((ItemDetailFragment) fragment).someMethod();