Code example for MenuItem

Methods: getItemId

0
    return(super.onCreateOptionsMenu(menu));
  } 
 
  @Override 
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case LOCAL_SEARCH_ID:
        onSearchRequested(); 
        return(true); 
       
      case GLOBAL_SEARCH_ID:
        startSearch(null, false, null, true); 
        return(true); 
    } 
 
    return(super.onOptionsItemSelected(item));
  } 
}