ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 67 - 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 public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true;}
Answers
A.
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true;}
B.
@Override public boolean onOptionsItemSelected(MenuItem item) { getMenuInflater().inflate(R.menu.menu_main, menu); returnsuper.onOptionsItemSelected(item); }
Answers
B.
@Override public boolean onOptionsItemSelected(MenuItem item) { getMenuInflater().inflate(R.menu.menu_main, menu); returnsuper.onOptionsItemSelected(item); }
C.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.menu.menu_main); }
Answers
C.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.menu.menu_main); }
Suggested answer: A

Explanation:

Reference:

https://developer.android.com/guide/topics/ui/menus

asked 18/09/2024
Melih Sivrikaya
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first