views:

78

answers:

2

I have a TabLayout containing tabs as intents to activities. I want to set custom menu items for each tab, but the onCreateOptionsMenu version called is the Host's version. How can I make the menu items created by each activity on its own.

+2  A: 

If all you want is the sub-Activity's menu instead of the TabActivity's menu, then you just need it to stop propagation of onCreateOptionsMenu(). That is, normally you call "return super.onCreateOptionsMenu(menu);" at the end, but if you just return true instead then only that sub-Activity's menu should be displayed for any particular tab.

Daniel Lew
A: 

A call to

boolean result = super.onCreateOptionsMenu();
// do anything but don't change anything in the menu in case of the specific menu u want
return result;

Do the same with onPrepareOptionsMeny()

MostafaEweda