ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 5 - Associate Android Developer discussion

Report
Export

The easiest way of adding menu items (to specify the options menu for an activity) is inflating an XML file into the Menu via MenuInflater. With menu_main.xml we can do it in this way:

A.
override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) return true}
Answers
A.
override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) return true}
B.
override fun onOptionsItemSelected(item: MenuItem): Boolean { menuInflater.inflate(R.menu.menu_main, menu) return super.onOptionsItemSelected(item) }
Answers
B.
override fun onOptionsItemSelected(item: MenuItem): Boolean { menuInflater.inflate(R.menu.menu_main, menu) return super.onOptionsItemSelected(item) }
C.
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.menu.menu_main) }
Answers
C.
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.menu.menu_main) }
Suggested answer: A

Explanation:

Reference: https://developer.android.com/guide/topics/ui/accessibility/custom-views

asked 18/09/2024
I Haq
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first