Code example for Fragment

Methods: setMenuVisibility

0
    @Override 
    public void setPrimaryItem(ViewGroup container, int position, Object object) {
        Fragment fragment = (Fragment) object;
        if (fragment != mCurrentPrimaryItem) {
            if (mCurrentPrimaryItem != null) {
                mCurrentPrimaryItem.setMenuVisibility(false);
                // mCurrentPrimaryItem.setUserVisibleHint(false); 
            } 
            if (fragment != null) {
                fragment.setMenuVisibility(true);
                // fragment.setUserVisibleHint(true); 
            } 
            mCurrentPrimaryItem = fragment;
        } 
    } 
 
    @Override 
    public void finishUpdate(ViewGroup container) {
        if (mCurTransaction != null) {
            mCurTransaction.commitAllowingStateLoss();
            mCurTransaction = null;