title: onCreateOptionsMenu on Samsung Galaxy Tablet 3 (GT-P5200)
body: <p>as this is my first question on stackoverflow I am a bit nervous and hope I did not do anything wrong (at least I used the search function).</p>
  
  <p>I have a problem during development an android app with following code (simplified) :</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_main);
  }
  
  public boolean onCreateOptionsMenu(Menu menu) {
  
      MenuItem test1 = menu.add(0, 1, 0, "test1");
      MenuItemCompat.setShowAsAction(test1, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
  
      MenuItem test2 = menu.add(0, 2, 0, "test2");
      MenuItemCompat.setShowAsAction(test2, MenuItemCompat.SHOW_AS_ACTION_NEVER);
  
      MenuItem test3 = menu.add(0, 3, 0, "test3");
      MenuItemCompat.setShowAsAction(test3, MenuItemCompat.SHOW_AS_ACTION_NEVER);
  
      MenuItem test4 = menu.add(0, 4, 0, "test4");
      MenuItemCompat.setShowAsAction(test4, MenuItemCompat.SHOW_AS_ACTION_NEVER);
  
      MenuItem test5 = menu.add(0, 5, 0, "test5");
      MenuItemCompat.setShowAsAction(test5, MenuItemCompat.SHOW_AS_ACTION_NEVER);
  
      return super.onCreateOptionsMenu(menu);
  
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      switch (item.getItemId()) {
          case 1:
              Toast.makeText(this, "1", Toast.LENGTH_SHORT).show();
              return true;
          case 2:
              Toast.makeText(this, "2", Toast.LENGTH_SHORT).show();
              return true;
          case 3:
              Toast.makeText(this, "3", Toast.LENGTH_SHORT).show();
              return true;
          case 4:
              Toast.makeText(this, "4", Toast.LENGTH_SHORT).show();
              return true;
          case 5:
              Toast.makeText(this, "5", Toast.LENGTH_SHORT).show();
              return true;
  
  
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  
  }
  </code></pre>
  
  <p>This works as expected on all my test devices amongst others Android 2.6.3, 4.1.x, 4.2.x, 4.4, 5.0</p>
  
  <p>Only one device make problems: </p>
  
  <ul>
  <li><strong>Galaxy Tab 3 (10.1)<br>
  GT-P5200 / Android 4.2.2</strong></li>
  </ul>
  
  <p>If I press the hardware menu button, no option menu is opening. Nothing happends. </p>
  
  <p>I am using </p>
  
  <ul>
  <li>android studio</li>
  <li>support library version 21.0.3</li>
  <li>minSdkVersion 8</li>
  <li>targetSdkVersion 21</li>
  </ul>
  
  <p>But strangely enough it works on other devices (e.g. Galaxy Note 8.0, GT-N5100, Android 4.2.2)</p>
  
  <p>Can anybody test the code above on your devices?
  Does anybody have a workaround?</p>
  
  <p><strong>~~ EDIT: ~~</strong></p>
  
  <p>I tried following code but the overflow menu does not open neither :-(</p>
  
  <pre><code> Button btnOpenMenu = (Button) findViewById(R.id.button);
  
      btnOpenMenu.setOnClickListener( new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              MainActivity.this.openOptionsMenu();
  
          }
      });
  </code></pre>
  
  <p>I think it must be a bug in the latest support library v7 version 21.0.x</p>
  
  <p>But why only on the Samsung Galaxy Tablet 3 ??</p>
  
  <p>Many thanks</p>
  
  <p>-Gra</p>