Get Item ID From Context Menu
<p>hey people,
I am trying to get the id of the item, in this case a table row, that was long pressed to bring up the context menu.  This is my code so far.</p>

<pre><code>@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenuInfo menuInfo) {
  super.onCreateContextMenu(menu, v, menuInfo);
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.context_menu, menu);
}

@Override
public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  switch (item.getItemId()) {
      case R.id.delete:

          deleteitem(id); //ID of item should be passed to method deleteitem
          Toast.makeText(this, "delete",
                    Toast.LENGTH_LONG).show();
        return true;
      default:
        return super.onContextItemSelected(item);
  }
}
</code></pre>

<p>As you can see I need the id of the table row to pass to another method.  I have tried using info however it is always null.  Obviously I am missing something here so hopefully you'll be able to point me in the right direction.  Thanks.</p>
