FragmantClass rSum = new FragmantClass();
getSupportFragmentManager().beginTransaction().remove(rSum).commit();
I am trying to remove this fragment, when i load switch another fragment. The above fragment does not get removed. Here is the method i am calling to switch fragments.
public void switchContent(Fragment fragment) {
FragmantClass rSum = new FragmantClass();
getSupportFragmentManager().beginTransaction().remove(rSum).commit();
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
getSlidingMenu().showContent();
}
question from:https://stackoverflow.com/questions/15857760/removing-fragments-from-an-activity