Removing fragments from an activity

getSupportFragmentManager().beginTransaction().
remove(getSupportFragmentManager().findFragmentById(R.id.frame)).commit();

Try this, it should work.

public void switchContent(Fragment fragment) {
    Fragment oldFragment = getSupportFragmentManager().findFragmentById(R.id.frame);
    if (oldFragment != null) { 
        getSupportFragmentManager().beginTransaction()
            .remove(oldFragment).commit();
    }
    mContent = fragment;
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.content_frame, fragment)
        .commit();
    getSlidingMenu().showContent();
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)