entering in code like this:
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
comes up with this error \"androi
getActivity() slove my issueandroid.app.FragmentManager fragmentManager = getActivity().getFragmentManager();
In Activity import android.app.Fragment .. In Fragment extend with android.app.Fragment.. this solved my issue...
Have you import android.support.v4.jar file to your project??
Ok...Just make a method for fragment and call this Like:
void addfragment(Fragment fragment, boolean addBacktoStack, int transition) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.simple_fragment, fragment);
ft.setTransition(transition);
if (addBacktoStack)
ft.addToBackStack(null);
ft.commit();
}
Now Just call Your Fragment:
addfragment(new DescriptionFragment(this),true, FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
try this
public class DescriptionFragment extends android.support.v4.app.Fragment
instead of simply Fragment.
With getSupportFragmentManager() you are getting the supportLibrary fragmentManager instead of the systems fragmentManager. So you are working with a transaction of the supportlibrary.
This is the reason why you need to add all these imports and use android.support.v4.app.
If you want to get the systems fragmentManager just try to use getFragmentManager() instead getSupportFragmentManager().
Hope this helps