I have many tabs like this:
TabHost th;
TabSpec spec;
th = (TabHost) findViewById(R.id.tabhost_template_two_tabs);
th.setup();
// all tab
spec = th.newTabSpec("All");
spec.setIndicator("All");
spec.setContent(R.id.tab_template_two_tabs_all);
th.addTab(spec);
// favorite tab
spec = th.newTabSpec("Favorite");
spec.setIndicator("Favorite");
spec.setContent(R.id.tab_template_two_tabs_favorite);
th.addTab(spec);
and for each tab i want to add a menu, how please?
Each
Tabin theTabHosthas a number starting from 0, so you have to know which tab you are in now by usingint currentTab = th.getCurrentTab();and then clear the previous menu by usingmenu.clear()then adding your new menu by usinginflater.inflater(menuID, menu)note:
onCreateOptionsMenuwill not help you in your case