Android
AND-401 · Question #55
Consider the following the code: public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.game_menu, menu); return true; } Which of the…
The correct answer is C. This function inflates an XML file in the res/menu folder into menu items. See the full explanation below for the reasoning.
Question
Consider the following the code:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.game_menu, menu); return true; } Which of the following is true about the code above?
Options
- AThe code is auto generated and should not be edited
- BThis method handles clicks and assign actions to menu items
- CThis function inflates an XML file in the res/menu folder into menu items
- DThis method inflates an XML file in the res/layout folder into layout.
How the community answered
(30 responses)- B10% (3)
- C83% (25)
- D7% (2)
Community Discussion
No community discussion yet for this question.