Code example for ContextMenu

Methods: add, getItem

0
	OnCreateContextMenuListener create_cmenu_loc(final long rowid, final Location loc){
		OnCreateContextMenuListener cmenu_loc = new OnCreateContextMenuListener() {
			@Override 
			public void onCreateContextMenu(ContextMenu menu, View v,
					ContextMenuInfo menuInfo) {
				menu.add("elimina posizione");
				menu.getItem(0).setOnMenuItemClickListener(new OnMenuItemClickListener() {
					@Override 
					public boolean onMenuItemClick(MenuItem item) {
						deleteLocation(rowid, loc);
						return true; 
					} 
				});			 
			} 
		}; 
		return cmenu_loc;
	}; 
	 
	protected void callTextEditor(){ 
		Intent i = new Intent();
		i.putExtra("id", getIntent().getExtras().getLong("id"));