You can simply use registerForContextMenu, for example:
TextView tv = new TextView(this); registerForContextMenu(tv);
and then override onCreateContextMenu to create the menu
@Override public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo);
where you can use the view identifier to convey events that occur when you click a menu item to distinguish which view is called an event.
@Override public boolean onContextItemSelected(MenuItem item) {
stealthcopter
source share