Code example for ListFragment

Methods: onCreateContextMenu

0
        registerForContextMenu(getListView());
    } 
 
	@Override 
	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
		super.onCreateContextMenu(menu, v, menuInfo);
 
		info = (AdapterContextMenuInfo) menuInfo;
		menu.setHeaderTitle("Crossing options"); 
		menu.add(Menu.NONE, info.position, 0, "View");
		menu.add(Menu.NONE, info.position, 0, "Delete");
	} 
 
	@Override 
	public boolean onContextItemSelected(MenuItem item) {
		if(item.getTitle() == "View"){
            MyBD mbd = new MyBD( this.getActivity(),uname);
            mbd.BorrarTemporal();
			mbd.InsertarTemporal(books.get(item.getItemId()));
            Intent intent = new Intent();
            intent.setClass(getActivity(), BookActivity.class);