Code example for FragmentManager

Methods: getBackStackEntryCount

0
     
    public void onBackStackChanged() 
    { 
        FragmentManager fm = getSupportFragmentManager();
         
        if (fm.getBackStackEntryCount() == 0)
        { 
            // This is the top fragment. Remove title and subtitle and category selection. 
            setActionBarTitle(null); 
            setActionBarSubtitle(null); 
             
            mCatId = mSubCatId = null;
        } 
    } 
     
    public void askModeSelected(int mode)
    { 
        boolean isPublic = mode == AskMode.PUBLIC;
         
        setActionBarTitle(isPublic ? R.string.public_question : R.string.private_question);