AND-401 Exam QuestionsBrowse all questions from this exam

AND-401 Exam - Question 31


What two methods you have to override when implementing Android option menus?

Show Answer
Correct Answer: C

To specify the options menu for an activity, you override onCreateOptionsMenu(). This method is where you inflate your menu resource into the Menu provided in the callback. When the user selects an item from the options menu, the system calls your activity's onOptionsItemSelected() method. This method handles the menu item clicks. Therefore, the two methods you have to override when implementing Android option menus are onCreateOptionsMenu and onOptionsItemSelected.

Discussion

2 comments
Sign in to comment
MmadiOption: A
Dec 31, 2022

A. onCreateOptionsMenu, onCreateContextMenu

MmadiOption: C
Dec 31, 2022

C. onCreateOptionsMenu, onOptionsItemSelected