Reputation: 409
I have a problem with tab bar visibility in non-tab bar activities. How to set tab bar in non tab activities?
code
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1");
TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2");
TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3");
firstTabSpec.setIndicator("First").setContent(new Intent(this,FirstTab.class));
secondTabSpec.setIndicator("Second ").setContent(new Intent(this,SecondTab.class));
thirdTabSpec.setIndicator("Third").setContent(new Intent(this,ThirdTab.class));
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(thirdTabSpec);
This is the code for tab bar..... I have 5 activities..firstTab,secondTab,thirdTab,fourthActivity,fifthActivity. But problem is, Tab bar visible for only 3 tab activities but not in fourthActivity and fifthActivity. How to show the tab bar in reamaining activities? please help me.....
Thanks...
Upvotes: 0
Views: 486
Reputation: 409
Solved. Change First Tab Activity as a Tab Group. Set Default Tab Group activity as First Tab.
firstTabSpec.setIndicator("First").setContent(new Intent(this,TABGROUP.class));
secondTabSpec.setIndicator("Second ").setContent(new Intent(this,SecondTab.class));
thirdTabSpec.setIndicator("Third").setContent(new Intent(this,ThirdTab.class));
Upvotes: 3