Android Application Development (AND-401) — Question 92

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?

Answer options

Correct answer: C

Explanation

The correct answer is C because the code specifically inflates the XML file from the res/menu folder into menu items. Option A is incorrect as the code can be modified; option B is wrong because this method does not handle click events; option D is false since it refers to the wrong directory for inflating layout files.