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:


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(

B . menu.menu_main, menu);
return true;
}
C . @Override
public boolean onOptionsItemSelected(MenuItem item) { getMenuInflater().inflate(
D . menu.menu_main, menu); return super.onOptionsItemSelected(item); }
E . @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(
F . menu.menu_main); }

Answer: A

Explanation:

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

Leave a Reply

Your email address will not be published.