title: different behavior with method onCreateOptionsMenu
body: <p>I found something confused for me in this article
  <a href="http://developer.android.com/guide/topics/ui/menus.html" rel="nofollow">http://developer.android.com/guide/topics/ui/menus.html</a></p>
  
  <p>Below is simple piece of code and output
  When I start application on android 3.0</p>
  
  <ol>
  <li>and 2. line system executed as soon as the activity is created</li>
  </ol>
  
  <p>The 3. and 4. lines were printed when menu was pressed and menu item was chosen</p>
  
  <p>Probem is line 5 and buttonHandler method, that method calls invalidateOptionsMenu();
  and result of that calls is line 6 and 7</p>
  
  <p>Why system calls onCreateOptionsMenu before onPrepareOptionsMenu even they have written </p>
  
  <blockquote>
    <p>On Android 3.0 and higher, you must call invalidateOptionsMenu() when you want to update the menu, because the menu is always open. The system will then call onPrepareOptionsMenu() so you can update the menu items.</p>
  </blockquote>
  
  <p>In this case onCreateOptionsMenu is called every time after invalidateOptionsMenu(),
  but when I start application on android 2.3 onCreateOptionsMenu was called only once.</p>
  
  <p>1 INFO/System.out(382): onCreateOptionsMenu<br>
  2 INFO/System.out(382): onPrepareOptionsMenu<br>
  3 INFO/System.out(382): onPrepareOptionsMenu<br>
  4 INFO/System.out(382): onOptionsItemSelected<br>
  5 INFO/System.out(382): buttonHandler<br>
  6 INFO/System.out(382): onCreateOptionsMenu<br>
  7 INFO/System.out(382): onPrepareOptionsMenu</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  }
  
  public boolean onCreateOptionsMenu(Menu menu) {
      System.out.println("onCreateOptionsMenu");
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.game_menu, menu);
      return true;
  }
  
  public boolean onPrepareOptionsMenu(Menu menu) {
      System.out.println("onPrepareOptionsMenu");
      return super.onPrepareOptionsMenu(menu);
  }
  
  public boolean onOptionsItemSelected(MenuItem item) {
      System.out.println("onOptionsItemSelected");
      return super.onOptionsItemSelected(item);
  }
  
  public void buttonHandler(View v){
      System.out.println("buttonHandler");
      invalidateOptionsMenu();
  }
  </code></pre>