Hello Android Developers,
I have seen a lot of question regarding the update of Options Menu. However, every answer says I have to call invalidateOptionsMenu()
.
My question is, is there any other way of updating the Options Menu without invoking the method invalidateOptionsMenu()
?
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.clear(); // Clear the menu first
/* Add the menu items */
return super.onPrepareOptionsMenu(menu);
}
This solved the problem on updating the OptionsMenu without invoking the invalidateOptionsMenu()