getSupportFragmentManager().beginTransaction().
remove(getSupportFragmentManager().findFragmentById(R.id.frame)).commit();
Try this, it should work.
public void switchContent(Fragment fragment) {
getSupportFragmentManager().beginTransaction().
remove(getSupportFragmentManager().findFragmentById(R.id.frame)).commit();
mContent = fragment;
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
getSlidingMenu().showContent();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…