Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get row position in onCreateContextMenu

I'm trying to create a context menu that changes the available options depending on which row was clicked.

But I can't figure out how to get the row position in the listview for row that was clicked, until after the menu is created.

like image 301
Ray Britton Avatar asked Sep 22 '10 19:09

Ray Britton


1 Answers

It is not obvious at all, but here's the code:

   public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
   {    
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
        int position = info.position;
like image 131
Mark B Avatar answered Oct 12 '22 08:10

Mark B