/** * 得到页面切换Switcher * * @return 页面切换Switcher */ public CoreSwitcher getSwitcher() { synchronized (BaseFragment.this) { // 加强保护,保证pageSwitcher 不为null if (mPageCoreSwitcher == null) { if (this.mActivity != null && this.mActivity instanceof CoreSwitcher) { mPageCoreSwitcher = (CoreSwitcher) this.mActivity; } if (mPageCoreSwitcher == null) { BaseActivity topActivity = BaseActivity.getTopActivity(); if (topActivity != null && topActivity instanceof CoreSwitcher) { mPageCoreSwitcher = (CoreSwitcher) topActivity; } } } } return mPageCoreSwitcher; }