Android Application Development (AND-401) — Question 31
What two methods you have to override when implementing Android option menus?
Answer options
- A. onCreateOptionsMenu, onCreateContextMenu
- B. onCreateContextMenu, onContextItemSelected
- C. onCreateOptionsMenu, onOptionsItemSelected
- D. onCreateOptionsMenu, onContextItemSelected
Correct answer: C
Explanation
The correct answer is C, as both onCreateOptionsMenu and onOptionsItemSelected are essential methods for handling option menus in Android. Option A includes an incorrect method, onCreateContextMenu, which is not relevant for option menus. Options B and D also contain methods that do not pertain to the direct implementation of option menus, thus making them incorrect.