Android Application Development (AND-401) — Question 30
What two methods you have to override when implementing Android context menus?
Answer options
- A. onCreateOptionsMenu, onCreateContextMenu
- B. onCreateContextMenu, onContextItemSelected
- C. onCreateOptionsMenu, onOptionsItemSelected
- D. onCreateOptionsMenu, onContextItemSelected
Correct answer: B
Explanation
The correct answer is B, as you need to override onCreateContextMenu to register the context menu and onContextItemSelected to handle the item selection. Options A, C, and D include methods that are not specifically related to context menus, making them incorrect for this particular implementation.