title: get view id from oncontextitemselected
body: <p>I've several buttons registered for context menu</p>
  
  <p>how do I know which button was clicked for the menu to appear?</p>
  
  <p>below is the pseudocode that i'll be using. I need to do something related to which button clicked (I have few more buttons to be declared), how do I know that the context menu is activated from which button click.</p>
  
  <p>EDIT: I think i didn't make myself clear, I wanted to know which button was clicked for the menu to appear. Not which menu item is clicked. Anyways, I've a solution which I'll add in pretty soon.</p>
  
  <p>thanks</p>
  
  <pre><code>private static final int SEND_AS_TEXT = Menu.FIRST;
  private static final int SEND_AS_IMAGE = Menu.FIRST + 1;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          sendAllBtn = (Button)findViewById(R.id.sendAllBtn);
          sendAllBtn.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          registerForContextMenu(v);
          openContextMenu(v);
      }
  
      @Override
      public boolean onContextItemSelected(MenuItem item) {
          // TODO Auto-generated method stub
          AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
          switch(item.getItemId()){
          case SEND_AS_TEXT:
              //do sth related to the button clicked
              break;
  
          }
          return super.onContextItemSelected(item);
      }
  
      @Override
      public void onCreateContextMenu(ContextMenu menu, View v,
              ContextMenuInfo menuInfo) {
          // TODO Auto-generated method stub
          super.onCreateContextMenu(menu, v, menuInfo);
          menu.add(Menu.NONE, SEND_AS_TEXT, SEND_AS_TEXT, "Send As Text");
          menu.add(Menu.NONE, SEND_AS_IMAGE, SEND_AS_IMAGE, "Send As Image");
      }
  </code></pre>