Within my apps I often enable/disable menu entries and do make them visible from onPrepareOptionsMenu.
Today I started to add the android:showAsAction menu attribute
Based on "Klaasvaak" answer above. I am using its subMenus. This works for me :
// Declare and save the menu as global, so it can be called anywhere.
Menu absTopSubMenus;
public boolean onCreateOptionsMenu(Menu menu) {
absTopSubMenus = menu; // Used for re-drawing this menu anywhere in the codes.
// The remainder of your code below
}
Then, to re-draw this, just call :
// Redraw the top sub-menu
absTopSubMenus.clear();
onCreateOptionsMenu(absTopSubMenus);