Which of the following applies a context menu on a ListView (Choose two)?
Which of the following applies a context menu on a ListView (Choose two)?
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.
B. ListView lv = getListView(); registerForContextMenu(lv); C. ListView lv = (ListView) findViewByld(R.id.list_view_id); registerForContextMenu(lv)