I have looked through the questions on stack overflow and can\'t find the solution.
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuInflater i
Its not enough to change the isDown
variable. You have to call the setVisible()
method every time you want to change the visibility. That method does more than just setting a boolean value, so just changing a boolean value will not do.
After changing the isDown
value to false, you need to call invalidateOptionsMenu()
which will re-launch the menu by calling onPrepareOptionsMenu()
again.
Try this code for making the menu items unvisible:
...
isdown = false;
invalidateOptionsMenu();
...