Having troubles with show() in the Show ImageFragment


In the section on “Showing Larger Image in a DialogFragment” under Show ImageFragment, when I called show() in onCreateView in CrimeFragment I was getting the error: “The method show(android.app.FragmentManager, java.lang.String) in the type DialogFragment is not applicable for the arguments (android.support.v4.app.FragmentManager, java.lang.String)”. Instead I replaced the line with “ImageFragment.newInstance(path).show(getActivity().getFragmentManager(), DIALOG_IMAGE);” and got rid of “FragmentManager fm = getActivity().getSupportFragmentManager();”. This seems to work.
Am I missing something? Did anyone else see this error?


hey man, did u solve this problem, I’m having trouble with this too. hope somebody could help to explain this


Check your class on ImageFragment and CrimeFragment, do they use the import android.support.v4.app.FragmentManager class instead of android.app.FragmentManager ?

The correct one is android.support.v4.app.FragmentManager

If I’m not mistaken, the error tells that you import the wrong library.