android - Optionsmenu in an TabActivity for a specific Tab -
My problem is that I have tabactivity, which now has 4 tabs The first tab is a special tab User can modify some data.
The problem is, if I add an option menu for the activity, the options menu is visible on each tab. I tried to check the current mTabHost.getCurrentTabTag () in onCreateOptionsMenu but if nothing changes it, how to do this?
(The following code, which still shows the options menu on each tab)
Public boolean permit menu (menu menu) {if (mTabHost GetCurrentTabTag () == GetString (R.string.tab_details)} {Boolean results = Super. Contempt option menu (menu); Menu.add (0, EDIT_ID, 0, R.string.menu_edit) .setIcon (R.drawable.edit); Return result; } Back true; } Maniteme selected on public boolean (int id, menu item) {switch (itat. ITMID)} {case EDIT_ID: {toast. Make Text (this, "O.O.", Toast. LNNHT_LOG). Show (); }} Come back super. Paramountime selected (feature ID, item); }
I think you're comparing strings with == ( In fact, tags) Generally, it is best to do this with the .equals ()
method. Perhaps this will solve your problem.
To dynamically update an option menu (from the document):
If you change this option menu every time, you can override the on-option option options menu Must do ()
Comments
Post a Comment