title: Handling Action Bars with two fragments
body: <p>I have a layout with two fragments and both fragments have their own action bars, each of which have their own action items and menus.  When my app is in landscape mode and both fragments are displayed on the screen, it looks like the framework is choosing to display the action bar on the "right" (or the 2nd fragment), which means the fragment on the left (1st fragment) is missing its action items and menu options.</p>
  
  <p>Everything works fine when the app is in portrait mode, so I'm not sure if I should be doing something to handle the fragments when they are both displayed.  Thanks.</p>
  
  <p>EDIT</p>
  
  <p>In each of my fragments I'm using this code to add menu items to the Action Bar:</p>
  
  <p>In fragment 1:</p>
  
  <pre><code>    @Override
      public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
          inflater.inflate(R.menu.fragment_menu_1, menu);
          super.onCreateOptionsMenu(menu, inflater);
      }
  </code></pre>
  
  <p>In fragment 2:</p>
  
  <pre><code>    @Override
      public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
          inflater.inflate(R.menu.fragment_menu_2, menu);
          super.onCreateOptionsMenu(menu, inflater);
      }
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>Apparently using <code>setRetainInstance(true)</code> is what caused the menus not to refresh.  I was using that because I have an AsyncTask that was throwing an exception if the device was rotated.  So I fixed one issue, but broke another.</p>