Android Application Development (AND-401) — Question 32
Which of the following is a call-back method that inflates an options menu from file res/menu/menu.xml?
Answer options
- A. onOptionsItemSelected
- B. onCreate
- C. onCreateMenu
- D. onCreateOptionsMenu
Correct answer: D
Explanation
The correct answer is D, onCreateOptionsMenu, as it is specifically designed to inflate the options menu from a specified resource file. The other options do not serve this purpose: A is for handling item selections, B is for initializing the activity, and C is not a standard callback method in this context.