Code example for MenuItem

Methods: getItemIdgetMenuInfo

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);
Experience pair programming with AI  Get Codota for Java