Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyTabActivity extends TabActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- tabContext = this;
- setTitle("My App Name");
- final TabHost tabHost = getTabHost();
- tabHost.addTab(tabHost.newTabSpec(TAB_1).setIndicator(TAB_1, getResources().getDrawable(R.drawable.tab1)).setContent(new Intent(this, first.class)));
- tabHost.addTab(tabHost.newTabSpec(TAB_2).setIndicator(TAB_2, getResources().getDrawable(R.drawable.tab2)).setContent(new Intent(this, second.class)));
- tabHost.setOnTabChangedListener(new OnTabChangeListener() {
- public void onTabChanged(String tabId) {
- setTabTitle();
- }
- });
- tabHost.setCurrentTabByTag(TAB_1);
- }
- }
- public void setTabTitle()
- {
- PrefManager prefManager = new PrefManager(getApplicationContext());
- String tabtitle = prefManager.getTitle();
- tabContext.setTitle("My App Name" + " " + tabtitle);
- }
- public static void setTabTitle(String title)
- {
- tabContext.setTitle("My App Name" + " " + title);
- }
- MyTabActivity myTabs = (MyTabActivity) this.getParent();
- myTabs.setTitle("This is First cool Activity");
Add Comment
Please, Sign In to add comment