title: How to display option menu in android in Android API 17?
body: <p>I am trying to display option menu. I am creating menu at run time using menu.add() method. I am using android API 17. IS there any menu button we have to click? I am having "menuItemsMap " as Map&lt;> instance variable and i m adding menu into that map so that i can reuse these menu.
  Thanks in Advance.</p>
  
  <pre><code>public boolean onCreateOptionsMenu(Menu menu) {
          menuItemsMap = new HashMap&lt;Integer, MenuItem&gt;();
          menuItemsMap.put(
                  R.string.pizzasCart_pizzasList,
                  menu.add(R.string.pizzasCart_pizzasList).setIcon(
                          R.drawable.script_edit));
          menuItemsMap.put(
                  R.string.pizzasList_viewShoppingCart,
                  menu.add(R.string.pizzasList_viewShoppingCart).setIcon(
                          R.drawable.cart));
          menuItemsMap.put(
                  R.string.pizzasCart_checkout,
                  menu.add(R.string.pizzasCart_checkout).setIcon(
                          R.drawable.cart_go));
          menuItemsMap.put(
                  R.string.pizzasList_viewUserData,
                  menu.add(R.string.pizzasList_viewUserData).setIcon(
                          R.drawable.user_green));
          /*menu.add(1,1,0,R.string.pizzasCart_pizzasList).setIcon(R.drawable.script_edit);
          menu.add(1,2,1,R.string.pizzasList_viewShoppingCart).setIcon(R.drawable.cart);
          menu.add(1,3,2,R.string.pizzasList_viewUserData).setIcon(R.drawable.user_green);*/      
          return true;
      }
  
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          setMenuItemState(R.string.pizzasCart_pizzasList, false, false);
          setMenuItemState(R.string.pizzasList_viewShoppingCart, true,
                  !isShoppingCartEmpty());
          setMenuItemState(R.string.pizzasCart_checkout, true,
                  isShoppingCartCheckoutAllowed());
          setMenuItemState(R.string.pizzasList_viewUserData, true, true);
  
          return true;
      }
  
      protected void setMenuItemState(int itemTitleResID, boolean visible, boolean enabled) {
          MenuItem item = menuItemsMap.get(itemTitleResID);
          item.setEnabled(enabled);
          item.setVisible(visible);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.getTitle().equals(getString(R.string.pizzasList_viewUserData))) {
              showUserDataActivity();
  
          } else if (item.getTitle().equals(
                  getString(R.string.pizzasCart_pizzasList))) {
              showPizzasListActivity();
  
          } else if (item.getTitle().equals(
                  getString(R.string.pizzasList_viewShoppingCart))) {
              showPizzasCartListActivity();
  
          } else if (item.getTitle().equals(
                  getString(R.string.pizzasCart_checkout))) {
              checkoutShoppingCartPromptUser();
          }
  
          return true;
      }
  </code></pre>