Best code examples for Android TabHost class (android.widget.TabHost)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TabHost class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android TabHost examples from Open Source projects
Examples using Android TabHost getTabWidget method:
This code example shows how to use the following methods: getTabWidget, setCurrentTab
168:	TabWidget widget = mTabHost.getTabWidget(); 
-
171:	mTabHost.setCurrentTab(position); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: addTab, getTabWidget, newTabSpec, setOnTabChangedListener, setup
66:	TabSpec tabSpec = mTabHost.newTabSpec(tag); 
-
72:	mTabHost.addTab(tabSpec); 
-
77:	TabWidget widget = mTabHost.getTabWidget(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, getTabWidget, newTabSpec
68:	tabHost.addTab(tabHost 
69:	.newTabSpec("tab1") 
-
74:	tabHost.addTab(tabHost 
75:	.newTabSpec("tab2") 
-
80:	tabHost.addTab(tabHost 
81:	.newTabSpec("tab3") 
-
86:	tabHost.addTab(tabHost 
87:	.newTabSpec("tab4") 
-
92:	tabHost.addTab(tabHost 
93:	.newTabSpec("tab5") 
-
98:	tabHost.addTab(tabHost 
99:	.newTabSpec("tab6") 
-
104:	TabWidget tw = tabHost.getTabWidget(); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost setCurrentTab method:
This code example shows how to use the following methods: setCurrentTab
63:	host.setCurrentTab(position); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setCurrentTab, setOnTabChangedListener, setup
35:	mTabHost.setup(); 
36:	mTabHost.setOnTabChangedListener(this); 
-
41:	TabHost.TabSpec dail = mTabHost.newTabSpec(DIAL); 
-
44:	mTabHost.addTab(dail); 
-
46:	TabHost.TabSpec contacts = mTabHost.newTabSpec(CONTACTS); 
-
49:	mTabHost.addTab(contacts); 
50:	mTabHost.setCurrentTab(1); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setCurrentTab
26:	TabHost.TabSpec localTabSpec1 = this.mTabHost.newTabSpec("BrandGoodReputationActivity"); 
-
31:	this.mTabHost.addTab(localTabSpec1); 
32:	TabHost.TabSpec localTabSpec2 = this.mTabHost.newTabSpec("BrandNeutralReputationActivity"); 
-
37:	this.mTabHost.addTab(localTabSpec2); 
38:	TabHost.TabSpec localTabSpec3 = this.mTabHost.newTabSpec("BrandBadReputationActivity"); 
-
43:	this.mTabHost.addTab(localTabSpec3); 
44:	this.mTabHost.setCurrentTab(this.index); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost addTab method:
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
95:	mTabHost.setup(); 
-
97:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab1").setIndicator("Tab 1"), ( tabInfo = new TabInfo("Tab1", Tab1Fragment.class, args))); 
-
99:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab2").setIndicator("Tab 2"), ( tabInfo = new TabInfo("Tab2", Tab2Fragment.class, args))); 
-
101:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab3").setIndicator("Tab 3"), ( tabInfo = new TabInfo("Tab3", Tab3Fragment.class, args))); 
-
106:	mTabHost.setOnTabChangedListener(this); 
-
132:	tabHost.addTab(tabSpec); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: addTab, clearAllTabs, newTabSpec, setCurrentTab
56:	tabHost.clearAllTabs(); 
57:	tabHost.addTab(tabHost.newTabSpec("tab_done") 
-
60:	tabHost.addTab(tabHost.newTabSpec("tab_current") 
-
63:	tabHost.addTab(tabHost.newTabSpec("tab_backlog") 
-
66:	tabHost.addTab(tabHost.newTabSpec("tab_icebox") 
-
70:	tabHost.setCurrentTab(1); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
118:	mTabHost.setup(); 
-
120:	TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab1").setIndicator("Tab 1"), ( tabInfo = new TabInfo("Tab1", Tab1Fragment.class, args))); 
-
122:	TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab2").setIndicator("Tab 2"), ( tabInfo = new TabInfo("Tab2", Tab2Fragment.class, args))); 
-
124:	TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab3").setIndicator("Tab 3"), ( tabInfo = new TabInfo("Tab3", Tab3Fragment.class, args))); 
-
129:	mTabHost.setOnTabChangedListener(this); 
-
143:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost clearAllTabs method:
This code example shows how to use the following methods: addTab, clearAllTabs, newTabSpec
71:	tabHost.clearAllTabs(); 
-
73:	tabHost.addTab(tabHost.newTabSpec("tab_projects") 
-
77:	tabHost.addTab(tabHost.newTabSpec("tab_activities") 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearAllTabs, getCurrentTab, setCurrentTab
38:	int currentTab = mTabHost.getCurrentTab(); 
-
40:	mTabHost.setCurrentTab(0); 
41:	mTabHost.clearAllTabs(); 
-
43:	mTabHost.setCurrentTab(currentTab); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addView, setOnTabChangedListener, setup, setLayoutParams
49:	TabHost tabHost = new TabHost( activity, null ); 
50:	tabHost.setLayoutParams( 
-
56:	tabHost.addView( tabRootView ); 
-
60:	tabHost.setup( ); 
-
62:	tabHost.setOnTabChangedListener( new TabChangeListener( handle ) ); 
-
64:	return new TabScreenWidget( handle, tabHost ); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
90:	mTabHost.setup(); 
-
92:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Add Expense").setIndicator("Add Expense"), ( tabInfo = new TabInfo("Add Expense", Tab1Fragment.class, args))); 
-
94:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab2").setIndicator("Tab 2"), ( tabInfo = new TabInfo("Tab2", Tab2Fragment.class, args))); 
-
96:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab3").setIndicator("Tab 3"), ( tabInfo = new TabInfo("Tab3", Tab3Fragment.class, args))); 
-
98:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab4").setIndicator("Tab 4"), ( tabInfo = new TabInfo("Tab4", Tab4Fragment.class, args))); 
-
102:	mTabHost.setOnTabChangedListener(this); 
-
128:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
86:	mTabHost.setup(); 
-
88:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab1").setIndicator("Overview"), ( tabInfo = new TabInfo("Tab1", TabFragment1.class, args))); 
-
90:	TabsFragmentActivity.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab2").setIndicator("Feeds"), ( tabInfo = new TabInfo("Tab2", TabFragment2.class, args))); 
-
95:	mTabHost.setOnTabChangedListener(this); 
-
121:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost getCurrentTabTag method:
This code example shows how to use the following methods: getCurrentTabTag, setCurrentTab
174:	mTabHost.getCurrentTabTag()); 
-
193:	mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG); 
-
195:	mTabHost.setCurrentTab(TAB_INDEX_DIALER); 
-
198:	mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); 
-
200:	mTabHost.setCurrentTab(mLastManuallySelectedTab); 
-
208:	mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); 
-
210:	mTabHost.setCurrentTab(TAB_INDEX_CONTACTS); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentTabTag
72:	outState.putString("tab", mTabHost.getCurrentTabTag()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentTabTag, setCurrentTab
198:	getActivity(mTabHost.getCurrentTabTag()); 
-
211:	mTabHost.setCurrentTab(TAB_INDEX_CALL_LOG); 
-
213:	mTabHost.setCurrentTab(TAB_INDEX_DIALER); 
-
216:	mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); 
-
222:	mTabHost.setCurrentTab(TAB_INDEX_FAVORITES); 
-
224:	mTabHost.setCurrentTab(TAB_INDEX_CONTACTS); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost newTabSpec method:
This code example shows how to use the following methods: addTab, newTabSpec, setup
27:	tabHost.setup(); 
-
29:	TabHost.TabSpec spec1 = tabHost.newTabSpec("tag1"); 
-
33:	tabHost.addTab(spec1); 
-
35:	TabHost.TabSpec spec2 = tabHost.newTabSpec("tag2"); 
-
39:	tabHost.addTab(spec2); 
-
41:	TabHost.TabSpec spec3 = tabHost.newTabSpec("tag3"); 
-
45:	tabHost.addTab(spec3); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec
182:	final TabHost.TabSpec tabSpec = tabHost.newTabSpec(tabId).setIndicator(context.getString(tabCaptionId)).setContent(intent); 
-
184:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setCurrentTab, setOnTabChangedListener
84:	tabHost.setOnTabChangedListener(this); 
-
88:	tabHost.addTab(tabHost.newTabSpec(GENERAL_TAB_TAG).setIndicator(GENERAL_TAB_TAG).setContent(intent)); 
89:	tabHost.addTab(tabHost.newTabSpec(BY_CATEGORY_TAB_TAG).setIndicator(BY_CATEGORY_TAB_TAG).setContent(intent)); 
90:	tabHost.addTab(tabHost.newTabSpec(BY_ADDRESS_TAB_TAG).setIndicator(BY_ADDRESS_TAB_TAG).setContent(intent)); 
-
92:	tabHost.setCurrentTab(0); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost getCurrentTab method:
This code example shows how to use the following methods: getCurrentTab, setCurrentTab, setCurrentTabByTag
161:	mTabHost.setCurrentTabByTag(cur); 
-
163:	if (mTabHost.getCurrentTab() < 0) { 
-
165:	mTabHost.setCurrentTabByTag(mDefaultTab); 
-
167:	mTabHost.setCurrentTab(mDefaultTabIndex); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost setCurrentTabByTag method:
This code example shows how to use the following methods: addTab, newTabSpec, setCurrentTabByTag
24:	this.c.addTab(this.c.newTabSpec("tab1").setIndicator(getString(2131429126)).setContent(new Intent(this, SoftwareManager2.class))); 
25:	this.c.addTab(this.c.newTabSpec("tab2").setIndicator(getString(2131429127)).setContent(new Intent(this, APKManagerActivity.class))); 
-
27:	this.c.setCurrentTabByTag("tab1"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setCurrentTabByTag
24:	TabHost.TabSpec spec = tabs.newTabSpec("tab1"); 
-
28:	tabs.addTab(spec); 
-
31:	spec = tabs.newTabSpec("tab2"); 
-
35:	tabs.addTab(spec); 
-
51:	tabs.setCurrentTabByTag("tab1"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setCurrentTabByTag
78:	mHost.setCurrentTabByTag("home_tab"); 
-
81:	mHost.setCurrentTabByTag("events_tab"); 
-
84:	mHost.setCurrentTabByTag("forum_tab"); 
-
87:	mHost.setCurrentTabByTag("weibo_tab"); 
-
90:	mHost.setCurrentTabByTag("more_tab"); 
Full Snippet Info
6
CodeRank
Examples using Android TabHost setup method:
This code example shows how to use the following methods: addTab, newTabSpec, setup
53:	tabHost.setup(); 
-
59:	tabHost.addTab(homeTab); 
60:	tabHost.addTab(projectTab); 
61:	tabHost.addTab(envelopeTab); 
62:	tabHost.addTab(mechanicalTab); 
-
72:	homeTab = tabHost.newTabSpec("Home"); 
-
84:	projectTab = tabHost.newTabSpec("Project"); 
-
96:	envelopeTab = tabHost.newTabSpec("Envelope"); 
-
108:	mechanicalTab = tabHost.newTabSpec("Mechanical"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
45:	objTabHost.setup(); 
-
49:	ActTab.ajouterTab(this, this.objTabHost, this.objTabHost.newTabSpec("Mes résultats").setIndicator("Mes résultats"), infoTab); 
-
53:	ActTab.ajouterTab(this, this.objTabHost, this.objTabHost.newTabSpec("Recherche").setIndicator("Recherche"), infoTab); 
-
57:	ActTab.ajouterTab(this, this.objTabHost, this.objTabHost.newTabSpec("Mes Quiz").setIndicator("Mes Quiz"), infoTab); 
-
61:	ActTab.ajouterTab(this, this.objTabHost, this.objTabHost.newTabSpec("Mon compte").setIndicator("Mon compte"), infoTab); 
-
67:	objTabHost.setOnTabChangedListener(this); 
-
86:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTabSpec, setOnTabChangedListener, setup
88:	mTabHost.setup(); 
-
90:	Tab_MyLapak.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab1").setIndicator("Barang Dijual"), ( tabInfo = new TabInfo("Tab1", Tab_Dijual.class, args))); 
-
92:	Tab_MyLapak.addTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab2").setIndicator("Barang Tidak Dijual"), ( tabInfo = new TabInfo("Tab2", Tab_TidakDijual.class, args))); 
-
98:	mTabHost.setOnTabChangedListener(this); 
-
124:	tabHost.addTab(tabSpec); 
Full Snippet Info
6
CodeRank
Examples for other Android TabHost methods:
Related Android TabHost Questions & Answers:
Other Android TabHost Examples
13:	        setContentView(R.layout.main);
14:	        
15:	        TabHost tabHost = getTabHost();
16:	        
17:	        // Tab for Photos

Read More

17:	        setContentView(R.layout.main);
18:	        
19:	        TabHost tabHost = getTabHost();
20:	        
21:	        // Inbox Tab

Read More

TabHost Class Overview
Container for a tabbed window view. This object holds two children: a set of tab labels that the user clicks to select a specific tab, and a FrameLayout object that displays the contents of that page. The individual elements are typically controlled using this container object, rat...
Methods
  • clearAllTabs
    Removes all tabs from the tab widget associated with this tab host.
  • newTabSpec
    Get a new TabHost.TabSpec associated with this tab host.
  • setOnTabChangedListener
    Register a callback to be invoked when the selected state of any of the items in this list changes
  • setup
    Call setup() before adding tabs if loading TabHost using findViewById().