Code example for FragmentManager

Methods: getBackStackEntryCount

0
    } 
 
 
    public void finishFragmentOrActivity(View v) {
        FragmentManager manager = getSupportFragmentManager();
        if (manager.getBackStackEntryCount() > 0)
            getSupportFragmentManager().popBackStack(); 
        else 
            finish(); 
    } 
 
    public void launchNewFragment(View v) {
        addFragment(new ExampleFragment(), true, FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    } 
} 
Experience pair programming with AI  Get Codota for Java