Identifying the view selected in a ContextMenu (Android)
<p>In Android, <code>onContextItemSelected</code> has a single <code>MenuItem</code> argument and so it isn't clear how to identify the view selected. <a href="http://developer.android.com/reference/android/view/MenuItem.html#getMenuInfo%28%29" rel="nofollow">MenuItem.getMenuInfo</a> provides access to <a href="http://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html" rel="nofollow">Contextmenu.ContextMenuInfo</a>, but while both known subclasses provide access to the target view, there does not appear to be an accessor on the interface.</p>

<p>One alternative is to save the <code>View</code> provided in <code>onCreateContextMenu</code> in a private class variable which relies on <code>onCreateContextMenu</code> not being called again in the activity before <code>onContextItemSelected</code>. Another is to use the id of the <code>View</code> for the <code>itemId</code> argument of <a href="http://developer.android.com/reference/android/view/Menu.html#add%28int,%20int,%20int,%20int%29" rel="nofollow">ContextMenu.add</a>. If we do this, we would then need to identify the option selected from the context menu by using its (possibly internationalised) title.</p>

<p>What is the best method for identifying the <code>View</code> selected in <code>onContextSelected</code>?</p>
