Is using menuItem.getItemId() valid in finding which MenuItem is selected by user?
<p>I have menu in my App. I need to check for the which menu item been selected by the user and take appropriate action. I did this as,</p>

<pre><code>    @Override
public boolean onOptionsItemSelected(MenuItem menuitem){
        String title = menuitem.getTitle().toString();
        int itemId = menuitem.getItemId();
                    switch(itemId){
                        case 2131296257:
                                -----------------;
                                break;
                        case 2131296258:
                                 ------------------;
                                 break;                             
                    }
</code></pre>

<p>But these MenuItem Id's are getting changed each time I run my App. Now I thought to compare the menuTitle with hard coded string values like ,</p>

<pre><code> String title = menuitem.getTitle().toString();

   if(title.equals("Settings..")){
                ------------- 
                ------------- 
                -------------
   } 
</code></pre>

<p>But I don't think it's a good practice. But I guess I can do the same using the menu titles defined in strings.xml. But I am not sure how to use this.... (like R.string.....).</p>

<p>Can someone suggest on this please.</p>

<p>Thanks</p>
