Step 1

public boolean onCreateContextMenu(Menu menu, View v ContextMenuInfo menulnfo) { super.onCreateContextMenu(menu, v, menulnfo); menu.add(0, DELETE ID, 0, R.string.menu delete);

The onCreateContextMenu() callback some passes other information in addition to the Menu object, such as the View that has been triggered for the menu and an extra object that may contain additional information about the object selected. However, we don't care about these here, because we only have one kind of object in the Activity that uses context menus. In the next step, we'll handle the menu item selection.

0 0

Post a comment