Code example for MenuItem

Methods: getItemId, getMenuInfo

0
        .setAlphabeticShortcut('d'); 
  } 
 
  @Override 
  public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case DELETE_ID:
        AdapterView.AdapterContextMenuInfo info=
          (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
 
        delete(info.id);
        return(true); 
    } 
 
    return(super.onOptionsItemSelected(item));
  } 
   
  private void add() { 
    LayoutInflater inflater=LayoutInflater.from(this);
    View addView=inflater.inflate(R.layout.add_edit, null);
    final DialogWrapper wrapper=new DialogWrapper(addView);