title: Android Text Menus
body: <p>I have some XML that I am using as an Android text menu.</p>
  
  <p>Here is the XML</p>
  
  <pre><code>   &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:id="@+id/menu_settings"
      android:title="@string/menu_settings"
      android:orderInCategory="100"
      android:showAsAction="never" /&gt;
  &lt;item android:id="@+id/menu_search" android:title="@string/menu_search"&gt;&lt;/item&gt;
  &lt;item android:id="@+id/exit" android:title="@string/menu_exit" android:orderInCategory="200" &gt;&lt;/item&gt;
  
   &lt;/menu&gt;
  </code></pre>
  
  <p>In inflate the menu using the following code</p>
  
  <pre><code>   public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  </code></pre>
  
  <p>When I am checking for the menu items clicked, I use this.</p>
  
  <pre><code>  public boolean onOptionsItemSelected(MenuItem item) {
          int itemid = item.getItemId();
          Toast.makeText(this, "You pressed the icon!" + itemid, itemid).show();
          return true;
      }
  </code></pre>
  
  <p>This is giving me a numeric ID for each menu item pressed. Should I use a case statement to check this and then launch the pages I want to open? Or is there a way for me to link an intent to a menu item ? Its seems like a bit of a waste to be adding this code to each screen.</p>