Citation:
public boolean onPrepareOptionsMenu (Menu menu)
Since: API Level 1
Prepare the Screen's standard options menu to be displayed. This is called right before the menu is shown, every time it is shown. You can use this method to efficiently enable/disable items or otherwise dynamically modify the contents.
The default implementation updates the system menu items based on the activity's state. Deriving classes should always call through to the base class implementation.
Parameters
menu The options menu as last shown or first initialized by onCreateOptionsMenu().
Returns
You must return true for the menu to be displayed; if you return false it will not be shown.
See Also
Pour cela il faut travailler sur la variable menu en autorisant /interdisant les items qui doivent s'afficher.