Android
AND-401 · Question #125
AND-401 Question #125: Real Exam Question with Answer & Explanation
Sign in or unlock AND-401 to reveal the answer and full explanation for question #125. The question stem and answer options stay visible for context.
Question
Consider the following : <?xml version="1.0" encoding="utf-8"?> <item android:id="@+id/create_new" android:title="@string/create_new" /> <item android:id="@+id/open" android:title="@string/open" /> </menu> public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.create_new: newFile(); return true default: 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?
Options
- AThe developer did not set onClickListener on the menu item.
- BThe developer did not include a case that corresponds to the menu item in method
- CThe developer should create onOptionsItemSelected method for each menu item.
- DThe developer should add the item to the menu resource file.
Unlock AND-401 to see the answer
You've previewed enough free AND-401 questions. Unlock AND-401 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.