Pass object reference to menu item selection handler
<p>I have a set of View instances that each represent some different data object (derived from Java.Lang.Object). I associate each view with its data object by setting the view's tag reference. The views can generate context menus, and in the onCreateContextMenu function I can get the source view and then get the data object from its tag.</p>

<p>My problem is that I can't find a way to associate the data object with the created menu or menu item such that I can get the data item in onContextItemSelected().</p>

<p>How do I propagate the data item to onContextItemSelected()?</p>

<p><strong>UPDATE</strong></p>

<p>From the link posted by @asktomsk it looks like what I want to do is only possible (without a lot of subclassing) if the originating view is a ListView. Having also read <a href="http://developer.android.com/guide/topics/ui/menus.html#context-menu" rel="nofollow">this</a> on the android developer site I suspect that long-tough context menus are probably not advisable anyway, and that I should find a different mechanism.</p>
