public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == R.id.listView1) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.home_context_menu, menu); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); /* AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { Log.e(TAG, "bad menuInfo", e); return; } Something something = (Subway) getListAdapter().getItem(info.position); menu.setHeaderTitle(something.getName()); menu.setHeaderIcon(something.getIcon()); menu.add(0, CONTEXT_MENU_SHARE, 0, "Do something!"); */ if (v.getId() == R.id.list_view_notes) { /* AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo; menu.setHeaderTitle(Countries[info.position]); String[] menuItems = getResources().getStringArray(R.array.menu); for (int i = 0; i<menuItems.length; i++) { menu.add(Menu.NONE, i, i, menuItems[i]); } */ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_edit, menu); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { switch (v.getId()) { case R.id.elvGroup: ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo; long packedPosition = info.packedPosition; menu.setHeaderIcon(R.drawable.menu_info).setHeaderTitle("菜单操作"); int type = ExpandableListView.getPackedPositionType(packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { menu.add(0, MENU_CHI_PLAY_ONE, 1, "播放该音乐"); menu.add(0, MENU_CHI_REMOVE, 1, "移除此项"); menu.add(0, MENU_SETRING, 1, "铃声设置"); } else { menu.add(0, MENU_ADD_GROUP, 2, "添加分组"); menu.add(0, MENU_DELETE_GROUP, 3, "删除分组"); menu.add(0, MENU_UPDATE_GROUP, 4, "更新分组名"); menu.add(0, MENU_CLEAR_GROUP, 3, "清空分组"); } menu.add(0, MENU_CHI_PLAYALL, 1, "播放分组"); break; case R.id.lvSounds: menu.setHeaderIcon(R.drawable.menu_info).setHeaderTitle(R.string.choice_do); menu.add(1, MENU_DOWN_MUSIC, 0, "下载音乐"); menu.add(1, MENU_LISTEN_MUSIC, 1, "播放音乐"); break; } super.onCreateContextMenu(menu, v, menuInfo); }
@Override public void onCreateContextMenu( ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); // Bail if not working with expandable long-press, or if not child if (!(menuInfo instanceof ExpandableListContextMenuInfo)) return; final ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo; final int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); final int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); // Skip long-press on expandable parents if (childPosition == -1) return; final AccountDisplay account = (AccountDisplay) mAdapter.getGroup(groupPosition); final GroupDelta child = (GroupDelta) mAdapter.getChild(groupPosition, childPosition); // Ignore when selective syncing unsupported final int syncMode = getSyncMode(account); if (syncMode == SYNC_MODE_UNSUPPORTED) return; if (child != null) { showRemoveSync(menu, account, child, syncMode); } else { showAddSync(menu, account, syncMode); } }
// 1. Creamos el Context Menu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); getMenuInflater().inflate(R.menu.menu_context_menu, menu); menu.setHeaderTitle("Cambiar Fondo de pantalla"); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, CONTEXT_EDIT, 0, R.string.edit); menu.add(0, CONTEXT_DELETE, 0, R.string.delete); menu.add(0, CONTEXT_BATCH_ADD, 0, R.string.batchadd); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_menu, menu); mSelectedSubject = (SubjectCard) v; }
/* Set up context menus for script list */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, EDIT_MENU, 0, R.string.Menu_edit); menu.add(0, EXECUTE_MENU, 0, R.string.Menu_run); menu.add(0, DELETE_MENU, 0, R.string.Menu_delete); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { stopComputerUpdates(false); // Call superclass super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position); // Inflate the context menu if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE || computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) { menu.add(Menu.NONE, WOL_ID, 1, getResources().getString(R.string.pcview_menu_send_wol)); menu.add(Menu.NONE, DELETE_ID, 2, getResources().getString(R.string.pcview_menu_delete_pc)); } else if (computer.details.pairState != PairState.PAIRED) { menu.add(Menu.NONE, PAIR_ID, 1, getResources().getString(R.string.pcview_menu_pair_pc)); menu.add(Menu.NONE, DELETE_ID, 2, getResources().getString(R.string.pcview_menu_delete_pc)); } else { if (computer.details.runningGameId != 0) { menu.add(Menu.NONE, RESUME_ID, 1, getResources().getString(R.string.applist_menu_resume)); menu.add(Menu.NONE, QUIT_ID, 2, getResources().getString(R.string.applist_menu_quit)); } menu.add(Menu.NONE, APP_LIST_ID, 3, getResources().getString(R.string.pcview_menu_app_list)); // FIXME: We used to be able to unpair here but it's been broken since GFE 2.1.x, so I've // replaced // it with delete which actually work menu.add(Menu.NONE, DELETE_ID, 4, getResources().getString(R.string.pcview_menu_delete_pc)); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; int ItemPosition = info.position; if (item_list.get(ItemPosition).get("StoreType").equals("2")) menu.add(0, 3, 0, "顯示我的商品"); if (item_list.get(ItemPosition).get("ChangeNumberCheck").equals("0")) menu.add(0, 0, 0, "顯示換號清單"); else if (item_list.get(ItemPosition).get("ChangeNumberCheck").equals("1")) { menu.add(0, 1, 0, "取消換號配對"); } else if (item_list.get(ItemPosition).get("ChangeNumberCheck").equals("2")) { menu.add(0, 1, 1, "取消換號配對"); menu.add(0, 2, 0, "確認換號配對"); } else if (item_list.get(ItemPosition).get("ChangeNumberCheck").equals("3")) { } else { // menu.add(0, 0, 0, "進入換號系統"); } menu.add(0, 4, 0, "刪除"); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterContextMenuInfo aMenuInfo = (AdapterContextMenuInfo) menuInfo; menu.add(0, CONTEXT_MENU_DELETE, 1, getString(R.string.context_delete)); super.onCreateContextMenu(menu, v, menuInfo); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (!kenKenGrid.mActive) return; getMenuInflater().inflate(R.menu.solutions, menu); return; }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); switch (v.getId()) { case R.id.btn: menu.setHeaderTitle("Countries"); listOfCoun = locationGet.getCountry(); for (int i = 0; i < listOfCoun.size(); i++) { menu.add(0, v.getId(), 0, listOfCoun.get(i)); } break; case R.id.btn2: menu.setHeaderTitle("Provinces/Territories"); listOfProv = locationGet.getProvinces(setCoun); for (int i = 0; i < listOfProv.size(); i++) { menu.add(0, v.getId(), 0, listOfProv.get(i)); } break; case R.id.btn3: menu.setHeaderTitle("Cities"); listOfCity = locationGet.getCity(setProv); for (int i = 0; i < listOfCity.size(); i++) { menu.add(0, v.getId(), 0, listOfCity.get(i)); } break; } }
@Override public void onCreateContextMenu( final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, MENU_DELETE_ONE, 0, R.string.delete); menu.add(0, MENU_EDIT, 0, R.string.edit); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { MenuItem llamar = menu.add("Llamar"); llamar.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent irParaTelefono = new Intent(Intent.ACTION_CALL); Uri llamarA = Uri.parse("tel:" + alumno.getTelefono()); irParaTelefono.setData(llamarA); startActivity(irParaTelefono); return false; } }); menu.add("Enviar un SMS"); MenuItem site = menu.add("Navegar a"); site.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent irParaSite = new Intent(Intent.ACTION_VIEW); Uri localSite = Uri.parse("http://" + alumno.getSite()); irParaSite.setData(localSite); startActivity(irParaSite); return false; } }); MenuItem eliminar = menu.add("Eliminar"); eliminar.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { AlumnoDAO dao = new AlumnoDAO(ListaAllumnos.this); dao.eliminar(alumno); dao.close(); cargarLista(); return false; } }); menu.add("Ver en el mapa"); menu.add("Enviar un email"); super.onCreateContextMenu(menu, v, menuInfo); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { Resources res = getResources(); super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(res.getString(R.string.menu_context_titulo)); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_context_mostrar_lista, menu); }
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Modify Step"); menu.add(0, ADD_STEP, 0, "Add Step After This"); menu.add(0, DUP_STEP, 0, "Duplicate This Step"); menu.add(0, UP_STEP, 0, "Move Up"); menu.add(0, DOWN_STEP, 0, "Move Down"); }
// Context Menu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Transactions Options"); menu.add(0, 0, 0, "Edit"); menu.add(0, 1, 0, "Delete"); }
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, CCM_SEND, 1, get18n("发送给朋友")); menu.add(0, CCM_LOCATE, 0, get18n("打开")); menu.add(0, CCM_EDIT, 2, get18n("编辑")); menu.add(0, CCM_DELETE, 3, get18n("删除")); }
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo info) { super.onCreateContextMenu(menu, v, info); menu.setHeaderTitle("Actions"); menu.add(CONTEXT_MENU_ID, CONTEXT_TOGGLE_NAV_ID, Menu.NONE, "Toggle Navigation"); menu.add(CONTEXT_MENU_ID, CONTEXT_PREFERENCES_ID, Menu.NONE, "Preferences"); menu.add(CONTEXT_MENU_ID, CONTEXT_README_ID, Menu.NONE, "Readme"); menu.add(CONTEXT_MENU_ID, CONTEXT_CLEAR_ID, Menu.NONE, "Clear Launcher"); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Elija el color de fondo"); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_main, menu); }
// This creates a menu on a long click public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); // menu.setHeaderIcon(R.drawable.icon); menu.setHeaderTitle("Edit Player"); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.player_menu, menu); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); int selectedPosition = ((AdapterView.AdapterContextMenuInfo) menuInfo).position; Resources res = getResources(); @SuppressWarnings("unused") MenuItem item; mSelectedCard = mDeck.cardFromId(Long.parseLong(mCards.get(selectedPosition).get("id"))); if (mSelectedCard.isMarked()) { item = menu.add( Menu.NONE, CONTEXT_MENU_MARK, Menu.NONE, res.getString(R.string.card_browser_unmark_card)); mIsMarked = true; Log.i(AnkiDroidApp.TAG, "Selected Card is currently marked"); } else { item = menu.add( Menu.NONE, CONTEXT_MENU_MARK, Menu.NONE, res.getString(R.string.card_browser_mark_card)); mIsMarked = false; } if (mSelectedCard.getSuspendedState()) { item = menu.add( Menu.NONE, CONTEXT_MENU_SUSPEND, Menu.NONE, res.getString(R.string.card_browser_unsuspend_card)); mIsSuspended = true; Log.i(AnkiDroidApp.TAG, "Selected Card is currently suspended"); } else { item = menu.add( Menu.NONE, CONTEXT_MENU_SUSPEND, Menu.NONE, res.getString(R.string.card_browser_suspend_card)); mIsSuspended = false; } item = menu.add( Menu.NONE, CONTEXT_MENU_DELETE, Menu.NONE, res.getString(R.string.card_browser_delete_card)); item = menu.add( Menu.NONE, CONTEXT_MENU_DETAILS, Menu.NONE, res.getString(R.string.card_browser_card_details)); menu.setHeaderTitle(mCards.get(selectedPosition).get("question")); }
// context menu code public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_menu, menu); // menu.setHeaderTitle("Please Select"); // menu.setHeaderIcon(R.drawable.ic_launcher); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == R.id.list) { menu.setHeaderTitle("Delete"); menu.add(Menu.NONE, 0, 0, "Delete Feed"); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderIcon(R.mipmap.item1); menu.setHeaderTitle("operation"); /** 使用代码动态添加,也可以使用xml加载 */ menu.add(1, 1, 1, "复制"); menu.add(1, 2, 1, "删除"); }
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(service); if (IsFolder.equalsIgnoreCase("Folder")) return; else { menu.add(Menu.NONE, CONTEXTMENU_OPTION1, 0, "Send To Dropbox"); menu.add(Menu.NONE, CONTEXTMENU_OPTION2, 0, "Download From Skydrive"); menu.setHeaderIcon(R.drawable.icon_skydrive); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId() == listFragment.getListView().getId()) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; ToDo toDo = listFragment.repository.getItem(info.position); getMenuInflater().inflate(R.menu.menu_item_context, menu); menu.setHeaderTitle(toDo.getTitle()); } }
// Context menu public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; TaskData taskSelected = (TaskData) tasklistAdapter.getItem(info.position); String taskTitle = taskSelected.getTitle(); menu.setHeaderTitle(taskTitle); menu.add(Menu.NONE, CONTEXT_EDIT, Menu.NONE, "Edit Task"); menu.add(Menu.NONE, CONTEXT_DELETE, Menu.NONE, "Delete Task"); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, 0, 0, "Ligar"); menu.add(0, 1, 0, "Enviar SMS"); menu.add(0, 2, 0, "Achar no mapa"); menu.add(0, 3, 0, "Navegar no site"); menu.add(0, 4, 0, "Deletar"); // menu.add(0,5,0,"Enviar e-mail"); }