title: ActionBar menu items not visible on some Android 4.1.2 devices
body: <p>two month ago I released an Android app v14 as MinSDKVersion and v19 as TargetSDKVersion. Everything works fine, beside that some users reports problem with the ActionBar menu items: </p>
  
  <p>They are shown on first app start but vanish when first switching away from a tab. </p>
  
  <p>The MainActivity of the App extends <code>FragmentActivity</code> and uses ActionBar Tabs to switch between 3 different pages (Fragments):</p>
  
  <pre><code>public class MainActivity extends FragmentActivity {
      protected void onCreate(Bundle savedInstanceState) {
          ...
          sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
          viewPager = (ViewPager)findViewById(R.id.pager);
          viewPager.setAdapter(sectionsPagerAdapter);
  
          viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
              @Override
              public void onPageSelected(int position) {
                  getActionBar().setSelectedNavigationItem(position); 
              }
          });
  
          ActionBar actionBar = getActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
          actionBar.setDisplayHomeAsUpEnabled(true);
          actionBar.setHomeButtonEnabled(true);
  
          ActionBar.TabListener tabListener = new ActionBar.TabListener() {
              public void onTabSelected(Tab tab, android.app.FragmentTransaction arg1) {
                  viewPager.setCurrentItem(tab.getPosition());
              }
  
              public void onTabReselected(Tab arg0, android.app.FragmentTransaction arg1) { }
              public void onTabUnselected(Tab arg0, android.app.FragmentTransaction arg1) { }
          };
  
          actionBar.addTab(actionBar.newTab()
                  .setText(R.string.LOC_Common_Overview)
                  .setTabListener(tabListener));
          actionBar.addTab(actionBar.newTab()
                  .setText(R.string.LOC_Contacts)
                  .setTabListener(tabListener));
          actionBar.addTab(actionBar.newTab()
                  .setText(R.string.LOC_Messages)
                  .setTabListener(tabListener));
  
          ...
      }
  }
  </code></pre>
  
  <p>An example of the menu file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; 
      &lt;item
          android:id="@+id/contacts_action_add"
          android:icon="@drawable/image__white__plus"
          android:showAsAction="always"
          android:title="@string/LOC_Create"&gt;
          &lt;menu&gt;
              &lt;item
                  android:id="@+id/contacts_action_add_entry"
                  android:icon="@drawable/image__white__person"
                  android:showAsAction="always"
                  android:title="@string/LOC_Contact"/&gt;
              &lt;item
                  android:id="@+id/contacts_action_add_group"
                  android:icon="@drawable/image__white__persons"
                  android:showAsAction="always"
                  android:title="@string/LOC_Group"/&gt;
          &lt;/menu&gt;
      &lt;/item&gt; 
  &lt;/menu&gt;
  </code></pre>
  
  <p>And an example of the Fragments:</p>
  
  <pre><code>public class ContactsFragment extends Fragment {
      public ContactsFragment() {
          super();
          setHasOptionsMenu(true);
      }
  
      ...
      private Menu optionsMenu;
      private MenuItem addEntryMenuItem;
      private MenuItem addGroupMenuItem;
  
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          Log.d("ContactsFragment: onCreateOptionsMenu");
          inflater.inflate(R.menu.menu_main__contacts, menu);
          optionsMenu = menu;
  
          if (optionsMenu != null) {
              Log.d("ContactsFragment: onCreateOptionsMenu - optionsMenu != null");
              addEntryMenuItem= optionsMenu.findItem(R.id.contacts_action_add_entry);
              addGroupMenuItem= optionsMenu.findItem(R.id.contacts_action_add_group);
          }
      }
  
      public boolean onOptionsItemSelected(MenuItem item) {
          Log.d("ContactsFragment: onOptionsItemSelected");
          if (item == addEntryMenuItem) {
              ...
              return true;
          } else if (item == addGroupMenuItem) {
              ...
              return true;
          } 
  
          return false;
      }
  }
  </code></pre>
  
  <p>I found several entries that deal with problems with ActionBar items but they all refere to apps with lower base SDKs, prior to 4.0. It seeems that there have been problems when transitioning apps from using the hardware menu button ActionBar menus. Since my app support SDK 14+ only this cannot be the solution in my case.</p>
  
  <p>User logs show, that the <code>onCreateOptionsMenu</code> method of the fragments is called and that the menues are inflated correctly. So why are the menu items not displayed correctly?</p>
  
  <p>The same code works without any problem on the waste majority of all devices, only a few users are effected. As far as I can tell they all use Android 4.1.2. Beside this I cannot see any similarities in devices, etc.</p>
  
  <p>Any idea how this problem can be solved?</p>
  
  <p>PS: Wether `android:showAsAction="always"`` is used or not for the menu items does not influende the problem.</p>