@Override public Object instantiateItem(ViewGroup container, int position) { TabInfo tab = mTabs.get(position); View root = tab.build(mInflater, mContentContainer, mRootView); container.addView(root); return root; }
public void updateCurrentTab(int position) { TabInfo tab = mTabs.get(position); mCurTab = tab; // Put things in the correct paused/resumed state. if (mActivityResumed) { mCurTab.build(mInflater, mContentContainer, mRootView); mCurTab.resume(mSortOrder); } else { mCurTab.pause(); } for (int i = 0; i < mTabs.size(); i++) { TabInfo t = mTabs.get(i); if (t != mCurTab) { t.pause(); } } mCurTab.updateStorageUsage(); updateOptionsMenu(); final Activity host = getActivity(); if (host != null) { host.invalidateOptionsMenu(); } }