Android
AND-401 · Question #117
Consider the following code : @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo)…
The correct answer is B. The code creates menu items for context menu programmatically. See the full explanation below for the reasoning.
Question
Consider the following code :
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle("Menu"); AdapterContextMenuInfo cmi = (AdapterContextMenuInfo) menuInfo; menu.add(1, cmi.position, 0, "Open file"); menu.add(2, cmi.position, 0, "Save file");} Which of the following best explains the code above?
Options
- AThe code inflates an xml file into menu items.
- BThe code creates menu items for context menu programmatically.
- CThe code assign actions to menu items.
- DThe code Opens a menu resource file, modifies it, and saves the changes.
How the community answered
(20 responses)- A5% (1)
- B75% (15)
- C5% (1)
- D15% (3)
Community Discussion
No community discussion yet for this question.