Code example for MenuItem

Methods: getItemId

0
    return(super.onCreateOptionsMenu(menu));
  } 
 
  @Override 
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case EDIT_ID:
        if (Build.VERSION.SDK_INT<Build.VERSION_CODES.HONEYCOMB) {
          startActivity(new Intent(this, EditPreferences.class));
        } 
        else { 
          startActivity(new Intent(this, EditPreferencesHC.class));
        } 
         
        return(true); 
    } 
 
    return(super.onOptionsItemSelected(item));
  } 
}