Code example for ListFragment

Methods: getListView, onCreateContextMenu

0
	// Handles the context menu creation 
	@Override 
	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
		 
		// Verify that the sender view is our listview 
		if (v.getId() == this.getListView().getId()) {
 
			menu.setHeaderTitle("Select action");
			menu.add(0, 0, 0, "Open this item");
			menu.add(0, 0, 0, "Clear log");
 
		} 
 
		super.onCreateContextMenu(menu, v, menuInfo);
 
	} 
	 
	// Handle the context menu item selection event 
	@Override 
	public boolean onContextItemSelected(MenuItem item) {