title: How to add a menu item to an existing Android app menu?
body: <p>I am very new at <code>android development</code> and am having trouble adding a new <code>Menu</code> item to the app's menu and getting it to open and present a menu <em>view layout</em> when tapped. I've so far only been able to change the <strong>menu.xml</strong> file for the app, which is enough to create a <code>button</code> that sits alongside others which show up when you press the <code>Menu</code> button but not enough to get it to link to anything.</p>
  
  <p>My goal is just to have pressing the button result in it connecting to a simple xml layout or dialogue page. I'm guessing I'll need to change the java code, but I'm not sure what exactly is needed to get this done. I'd appreciate any suggestions.</p>
  
  <p>It seems to end "To use the menu in your activity, you need to inflate the menu resource (convert the XML resource into a programmable object) using MenuInflater.inflate(). In the following sections, you'll see how to inflate a menu for each menu type." I guess what I need to know is how to add the item to the inflator for the other items.</p>
  
  <p>Does anyone happen to have a vanilla version of something I can insert?</p>
  
  <p>Here is an example of existing code which opens a dialogue and which deals with a close and "changes" button:</p>
  
  <pre><code>private void openHelpDialog() {
      LayoutInflater li = LayoutInflater.from(this);
      View view = li.inflate(R.layout.aboutview, null); 
      TextView tv = (TextView)view.findViewById(R.id.aboutVersionCode);
      tv.setText(getVersionName() + " (revision " + getVersionNumber() + ")");
      new AlertDialog.Builder(MainActivity.this)
      .setTitle(getResources().getString(R.string.application_name) + " " + getResources().getString(R.string.menu_help))
      .setIcon(R.drawable.about)
      .setView(view)
      .setNeutralButton(R.string.menu_changes, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            MainActivity.this.openChangesDialog();
        }
      })
      .setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
        }
      })
      .show();  
  }
  
  private void openChangesDialog() {
    LayoutInflater li = LayoutInflater.from(this);
    View view = li.inflate(R.layout.changeview, null); 
    new AlertDialog.Builder(MainActivity.this)
    .setTitle(R.string.changelog_title)
    .setIcon(R.drawable.about)
    .setView(view)
    .setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
          //
      }
    })
    .show();  
  }
  
  private void openClearDialog() {
      new AlertDialog.Builder(MainActivity.this)
      .setTitle(R.string.context_menu_clear_grid_confirmation_title)
      .setMessage(R.string.context_menu_clear_grid_confirmation_message)
      .setIcon(android.R.drawable.ic_dialog_alert)
      .setNegativeButton(R.string.context_menu_clear_grid_negative_button_label, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            //
        }
      })
      .setPositiveButton(R.string.context_menu_clear_grid_positive_button_label, new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
              MainActivity.this.kenKenGrid.clearUserValues();
          }
      })
      .show();  
    }
  </code></pre>