Exam AND-401 All QuestionsBrowse all questions from this exam
Question 105

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

    Correct Answer: B, C

    To apply a context menu on a ListView, you need to register the ListView with the context menu using the registerForContextMenu() method. This can be done by obtaining the ListView either through getListView() or by finding it using findViewById(), and then passing it to the registerForContextMenu() method. Therefore, both B and C are correct as they correctly show these implementations.

Discussion
MmadiOptions: BC

B. ListView lv = getListView(); registerForContextMenu(lv); C. ListView lv = (ListView) findViewByld(R.id.list_view_id); registerForContextMenu(lv)