解决方法
文件说明如下:
public boolean onCreateOptionsMenu (Menu menu)
初始化活动标准选项菜单的内容.您应该将菜单项放入菜单.这只是一次调用,第一次显示选项菜单.要在每次显示时更新菜单,请参阅onPrepareOptionsMenu(菜单).
并引用CommonsWare提出的另一个相关问题:
The onCreate method is called first,and before it finishes onCreateOptionsMenu is called.
That will be true on devices and apps with an official Honeycomb-style action bar. If there is no action bar,onCreateOptionsMenu() should not get called until the user calls up the menu,typically by pressing the MENU button.
链接:Android: When is onCreateOptionsMenu called during Activity lifecycle?