@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); if (item.getItemId() == R.id.detlist_menu_edit) { detailListHelper.doEditDetail(info.position); return true; } else if (item.getItemId() == R.id.detlist_menu_delete) { detailListHelper.doDeleteDetail(info.position); return true; } else if (item.getItemId() == R.id.detlist_menu_copy) { detailListHelper.doCopyDetail(info.position); return true; } return super.onContextItemSelected(item); }
private void initialContent() { detailListHelper = new DetailListHelper( this, i18n, calHelper, false, new DetailListHelper.OnDetailListener() { @Override public void onDetailDeleted(Detail detail) { GUIs.shortToast(SearchActivity.this, i18n.string(R.string.msg_detail_deleted)); doOk(); } }); ListView listView = (ListView) findViewById(R.id.searchResult_list); detailListHelper.setup(listView); registerForContextMenu(listView); }