First, the code...
ListView listView = (ListView) findItemById(R.id.listView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(){
public void onClick(final int position, final View convertView, final ViewGroup parent){
PopupMenu popupMenu = new PopupMenu(MainActivity.this, adapter.getView(position, convertView, parent));
popupMenu.inflate(R.menu.menu);
}
};
listView.setAdapter(adapter);
But the menu pops up at the top left of the screen, not at the row. What must I do to achieve that?