Free AND-401 Exam Braindumps
Android Application Development Questions 106–110 (page: 23)

Updated On: 9-Feb-2026

Which of the following applies a context menu on a ListView (Choose two)?

  1. ListView lv = getListView();
    lv.registerForContextMenu()
  2. ListView lv = getListView();
    registerForContextMenu(lv);
  3. ListView lv = (ListView) findViewByld(R.id.list_view_id);
    registerForContextMenu(lv)
  4. getListView().setContextMenuEnabled(true)

Answer(s): B,C

Explanation:

B: The first thing to do is to register your ListView as having a context menu, using the registerForContextMenu() method. The following lines of code in your ListActivity's onCreate() method accomplish this:
ListView lv = getListView();
registerForContextMenu(lv);


Reference:

http://htc-magic-android.gb-eu.com/131/accessing-listview-items-with-a-context-menu.html http://developer.android.com/reference/android/view/ContextMenu.html



Which of the following best explains the Android context menus?

  1. It is a popup menu displays a list of items in a vertical list that’s anchored to the view that invoked the menu.
  2. It is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.
  3. It is the primary collection of menu items for an activity. It’s where you should place actions that have a global impact on the app, such as “Search”, “Compose email”, and “Settings”.
  4. It is a sub-menu of an options menu item.

Answer(s): B

Explanation:

To show a context menu on long click, most clients will want to call registerForContextMenu(View). Reference:
http://developer.android.com/reference/android/view/ContextMenu.html



Which of the following is NOT a feature provided by the Material Theme?

  1. System widgets that let you set their color palette.
  2. Adding a fragment component to layout.
  3. Activity transition animations.
  4. Touch feedback animations for the system widgets.

Answer(s): B

Explanation:

Material theme provides:
System widgets that let you set their color palette
Touch feedback animations for the system widgets
Activity transition animations


Reference:

http://developer.android.com/training/material/theme.html



Which of the following statements is NOT correct about Android fragments?

  1. Multiple fragments can be combined in a single activity.
  2. The life-cycle of a fragment is totally independent of the activity hosting it.
  3. Fragments have their own life-cycle.
  4. You can add/remove fragments to and an activity dynamically, i.e. while the activity is running.

Answer(s): B

Explanation:

Fragment life cycle is closely related to the life cycle of its host activity which means when the activity is paused; all the fragments available in the activity will also be stopped.
Incorrect:
D: You can add or remove fragments in an activity while the activity is running.


Reference:

http://www.tutorialspoint.com/android/android_fragments.htm



Which of the following are benefits for using fragments in your application? (Choose two)

  1. Simplify the reusability of UI components.
  2. Build different layouts for different device configurations.
  3. Add an action bar to your application.
  4. Dynamically add and remove UI components to an activity.

Answer(s): B,D

Explanation:

B: Following is a typical example of how two UI modules defined by fragments can be combined into one activity for a tablet design, but separated for a handset design.
D: You can combine multiple fragments in a single activity to build a multi-plane UI.


Reference:

http://www.tutorialspoint.com/android/android_fragments.htm https://developer.android.com/guide/components/fragments.html



Viewing page 23 of 47
Viewing questions 111 - 115 out of 228 questions


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

AI Tutor AI Tutor 👋 I’m here to help!