AND-401 question 41 discussion


Consider the following :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="">
<item android:id="@+id/create_new"
android:title="@string/create_new" />
<item android:id="@+id/open"
android:title="@string/open" />
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
return true
return super.onOptionsItemSelected(item);
Upon clicking on one of the menu items, the application did not behave as intended. Which
of the following might be the cause of this problem?

  • A. The developer did not set onClickListener on the menu item.
  • B. The developer did not include a case that corresponds to the menu item in method onOptionsItemSelected.
  • C. The developer should create onOptionsItemSelected method for each menu item.
  • D. The developer should add the item to the menu resource file.
Created 5 months, 3 weeks ago by thomasgatt


None of the options are valid in this case. The developer DID include a case that corresponds to the menu item... case is correct. Can someone confirm this?