Free AND-401 Exam Braindumps

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



Which of the following is the base class of all UI components?

  1. ListView
  2. Layout
  3. View
  4. ViewGroup

Answer(s): C

Explanation:

View is the base class for android.widget subclasses, which instantiate fully-implemented UI objects. Reference:
http://eagle.phys.utk.edu/guidry/android/androidUserInterface.html






Post your Comments and Discuss Android AND-401 exam with other Community members: