Code example for FragmentActivity

Methods: onOptionsItemSelected

0
      case ADD_ID:
        add(); 
        return(true); 
    } 
 
    return(super.onOptionsItemSelected(item));
  } 
 
  @Override 
  public void onCreateContextMenu(ContextMenu menu, View v,
                                  ContextMenu.ContextMenuInfo menuInfo) {
    menu.add(Menu.NONE, DELETE_ID, Menu.NONE, "Delete")
        .setAlphabeticShortcut('d');
  } 
 
  @Override 
  public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case DELETE_ID:
        AdapterView.AdapterContextMenuInfo info=
            (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();