List of usage examples for android.widget TabHost.TabSpec getTag
@ViewDebug.ExportedProperty
public Object getTag()
From source file:com.github.mobile.ui.fragments.TabsAdapter.java
public void addTab(final TabHost.TabSpec tabSpec, final Class<?> clss, final Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); final String tag = tabSpec.getTag(); final TabInfo info = new TabInfo(tag, clss, args); mTabs.add(info);// w w w . j a v a 2 s.co m mTabHost.addTab(tabSpec); notifyDataSetChanged(); }
From source file:org.openbmap.utils.TabManager.java
public void addTab(final TabHost.TabSpec tabSpec, final Class<?> clss, final Bundle args) { tabSpec.setContent(new DummyTabFactory(mActivity)); final String tag = tabSpec.getTag(); final TabInfo info = new TabInfo(tag, clss, args); // Check to see if we already have a fragment for this tab, probably // from a previously saved state. If so, deactivate it, because our // initial state is that a tab isn't shown. info.fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { final FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction(); ft.detach(info.fragment);/*ww w .ja v a 2s. c o m*/ ft.commit(); } mTabs.put(tag, info); mTabHost.addTab(tabSpec); }
From source file:com.snippet.app.ActionBarCompatActivity.java
private void addTab(final TabHost.TabSpec tabSpec, final TabInfo tabInfo) { // Attach a Tab view factory to the spec tabSpec.setContent(new TabFactory(this)); String tag = tabSpec.getTag(); // Check to see if we already have a mFragment for this tab, probably // from a previously saved state. If so, deactivate it, because our // initial state is that a tab isn't shown. tabInfo.mFragment = getSupportFragmentManager().findFragmentByTag(tag); if (tabInfo.mFragment != null && !tabInfo.mFragment.isDetached()) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.detach(tabInfo.mFragment);//from ww w. ja v a 2 s. c o m ft.commit(); getSupportFragmentManager().executePendingTransactions(); } mapTabInfo.put(tabInfo.mTag, tabInfo); mTabHost.addTab(tabSpec); }
From source file:co.vmob.sample.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); final String tag = tabSpec.getTag(); final TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { final FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);/*from www . j a v a 2 s . co m*/ ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
From source file:android.support.v13.app.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);//from ww w. ja v a2s. com ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.miqian.mq.views.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);/*from ww w . j a v a 2 s . c o m*/ ft.commitAllowingStateLoss(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.example.almin.widget.MyFragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); // ft.detach(info.fragment); ft.hide(info.fragment);// w w w . jav a 2 s . co m ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.example.sample.view.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); // ft.detach(info.fragment); ft.hide(info.fragment);//from w w w.j ava2 s . co m ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.summer.framework.ui.widget.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); // ft.detach(info.fragment); ft.hide(info.fragment);/* w ww .j a v a 2 s.c om*/ ft.commit(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.ustc.dystu.dandelion.fragment.BaseFragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);// ww w. ja v a 2 s. c o m ft.commit(); } } mTabs.add(info); addTab(tabSpec); }