title: Restore changed menu state after rotation of a device
body: <p>I'm writing an application, which has a menu with buttons and an image. I press the button and label of the button changes from "Record track" to "Stop recording". The issue is when I rotate my device, the activity with buttons gets killed by the OS. So, I understood that I have to save my data before it's get killed in <code>onSaveInstanceState</code> method and then restore it in my <code>onCreate</code> method. Something like this:</p>
  
  <pre><code>@Override
  public void onSaveInstanceState(final Bundle saveInstanceState) {
      saveInstanceState.putSerializable("image", image);
      saveInstanceState.putSerializable("buttonState", isRecording);
  
  }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>if (savedInstanceState != null) {                                
      isRecording = savedInstanceState.getBoolean("buttonState");  
  
      if (menu != null) {                                          
          MenuItem recordButton = menu.getItem(R.id.track);
  
          if (!isRecording) {
              recordButton.setTitle(R.string.rec_track_label);     
          } else {
              recordButton.setTitle(R.string.stop_rec_track_label);
          }
      }                                                            
  
      Image = (Image)savedInstanceState.getSerializable("image");
  
  } 
  </code></pre>
  
  <p>And while it perfectly restores my image, I still have issues with the menu: for some reason it always stays "null", so it will never change label of my button despite that it should be recreated every time, when Activity starts and I save it in a private object of my Activity:</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      new MenuInflater(this).inflate(R.menu.actions, menu);
      this.menu = menu;
      return (super.onCreateOptionsMenu(menu));
  }
  </code></pre>
  
  <p>Any ideas what am I doing wrong? Thanks.</p>