Android AND-401 Exam (page: 7)
Android Application Development
Updated on: 25-Dec-2025

Viewing Page 7 of 47

What two methods you have to override when implementing Android context menus?

  1. onCreateOptionsMenu, onCreateContextMenu
  2. onCreateContextMenu, onContextItemSelected
  3. onCreateOptionsMenu, onOptionsItemSelected
  4. onCreateOptionsMenu, onContextItemSelected

Answer(s): B

Explanation:

Need to create context menu. For this need to override this method:
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("My Context Menu");
menu.add(0, NEW_MENU_ITEM, 0, "new");
menu.add(0, SAVE_MENU_ITEM, 1, "save");
}
And last one need to handle menu clicks:
@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case NEW_MENU_ITEM:
doSomething();
break;
case SAVE_MENU_ITEM:
doSomething();
break;
}
return super.onContextItemSelected(item);
}


Reference:

https://thedevelopersinfo.wordpress.com/2009/11/06/using-context-menus-in-android/



What two methods you have to override when implementing Android option menus?

  1. onCreateOptionsMenu, onCreateContextMenu
  2. onCreateContextMenu, onContextItemSelected
  3. onCreateOptionsMenu, onOptionsItemSelected
  4. onCreateOptionsMenu, onContextItemSelected

Answer(s): C

Explanation:

To specify the options menu for an activity, override onCreateOptionsMenu().
When the user selects an item from the options menu (including action items in the app bar), the system calls your activity's onOptionsItemSelected() method. This method passes the MenuItem selected. You can identify the item by calling getItemId(), which returns the unique ID for the menu item (defined by the android:id attribute in the menu resource or with an integer given to the add() method). You can match this ID against known menu items to perform the appropriate action.
For example:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Etc.


Reference:

http://developer.android.com/guide/topics/ui/menus.html



Which of the following is a call-back method that inflates an options menu from file res/menu/menu.xml?

  1. onOptionsItemSelected
  2. onCreate
  3. onCreateMenu
  4. onCreateOptionsMenu

Answer(s): D

Explanation:

To specify the options menu for an activity, override onCreateOptionsMenu() (fragments provide their own onCreateOptionsMenu() callback). In this method, you can inflate your menu resource (defined in XML) into the Menu provided in the callback. For example:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.game_menu, menu);
return true;
}


Reference:

http://developer.android.com/guide/topics/ui/menus.html



Which of the following Activity methods is invoked when the user clicks on an options menu item?

  1. onItemClicked
  2. onItemSelected
  3. onOptionsItemClicked
  4. onOptionsItemSelected

Answer(s): D

Explanation:

When the user selects an item from the options menu (including action items in the app bar), the system calls your activity's onOptionsItemSelected() method.


Reference:

http://developer.android.com/guide/topics/ui/menus.html



Which of the following WebView methods allows you to manually load custom HTML markup?

  1. loadData
  2. loadHTML
  3. loadCustomData
  4. loadCustomHTML

Answer(s): A

Explanation:

Example: To load the desired web page from an HTML string:
String summary = "<html><body>You scored <b>192</b> points.</body></html>"; webview.loadData(summary, "text/html", null);


Reference:

http://developer.android.com/reference/android/webkit/WebView.html



Viewing Page 7 of 47



Share your comments for Android AND-401 exam with other users:

loso 7/25/2023 5:18:00 AM

please upload thank.
THAILAND


Paul 6/23/2023 7:12:00 AM

please can you share 1z0-1055-22 dump pls
UNITED STATES


exampei 10/7/2023 8:14:00 AM

i will wait impatiently. thank youu
Anonymous


Prince 10/31/2023 9:09:00 PM

is it possible to clear the exam if we focus on only these 156 questions instead of 623 questions? kindly help!
Anonymous


Ali Azam 12/7/2023 1:51:00 AM

really helped with preparation of my scrum exam
Anonymous


Jerman 9/29/2023 8:46:00 AM

very informative and through explanations
Anonymous


Jimmy 11/4/2023 12:11:00 PM

prep for exam
INDONESIA


Abhi 9/19/2023 1:22:00 PM

thanks for helping us
Anonymous


mrtom33 11/20/2023 4:51:00 AM

i prepared for the eccouncil 350-401 exam. i scored 92% on the test.
Anonymous


JUAN 6/28/2023 2:12:00 AM

aba questions to practice
UNITED STATES


LK 1/2/2024 11:56:00 AM

great content
Anonymous


Srijeeta 10/8/2023 6:24:00 AM

how do i get the remaining questions?
INDIA


Jovanne 7/26/2022 11:42:00 PM

well formatted pdf and the test engine software is free. well worth the money i sept.
ITALY


CHINIMILLI SATISH 8/29/2023 6:22:00 AM

looking for 1z0-116
Anonymous


Pedro Afonso 1/15/2024 8:01:00 AM

in question 22, shouldnt be in the data (option a) layer?
Anonymous


Pushkar 11/7/2022 12:12:00 AM

the questions are incredibly close to real exam. you people are amazing.
INDIA


Ankit S 11/13/2023 3:58:00 AM

q15. answer is b. simple
UNITED STATES


S. R 12/8/2023 9:41:00 AM

great practice
FRANCE


Mungara 3/14/2023 12:10:00 AM

thanks to this exam dumps, i felt confident and passed my exam with ease.
UNITED STATES


Anonymous 7/25/2023 2:55:00 AM

need 1z0-1105-22 exam
Anonymous


Nigora 5/31/2022 10:05:00 PM

this is a beautiful tool. passed after a week of studying.
UNITED STATES


Av dey 8/16/2023 2:35:00 PM

can you please upload the dumps for 1z0-1096-23 for oracle
INDIA


Mayur Shermale 11/23/2023 12:22:00 AM

its intresting, i would like to learn more abouth this
JAPAN


JM 12/19/2023 2:23:00 PM

q252: dns poisoning is the correct answer, not locator redirection. beaconing is detected from a host. this indicates that the system has been infected with malware, which could be the source of local dns poisoning. location redirection works by either embedding the redirection in the original websites code or having a user click on a url that has an embedded redirect. since users at a different office are not getting redirected, it isnt an embedded redirection on the original website and since the user is manually typing in the url and not clicking a link, it isnt a modified link.
UNITED STATES


Freddie 12/12/2023 12:37:00 PM

helpful dump questions
SOUTH AFRICA


Da Costa 8/25/2023 7:30:00 AM

question 423 eigrp uses metric
Anonymous


Bsmaind 8/20/2023 9:22:00 AM

hello nice dumps
Anonymous


beau 1/12/2024 4:53:00 PM

good resource for learning
UNITED STATES


Sandeep 12/29/2023 4:07:00 AM

very useful
Anonymous


kevin 9/29/2023 8:04:00 AM

physical tempering techniques
Anonymous


Blessious Phiri 8/15/2023 4:08:00 PM

its giving best technical knowledge
Anonymous


Testbear 6/13/2023 11:15:00 AM

please upload
ITALY


shime 10/24/2023 4:23:00 AM

great question with explanation thanks!!
ETHIOPIA


Thembelani 5/30/2023 2:40:00 AM

does this exam have lab sections?
Anonymous