Select distinct elements in listview when click item
<p>I have a list view with custom adapter, with an Image Button and a Text View.</p>

<p>I want to open a context menu when a press is made on the Image Button, and open another context menu if i press the Text View.</p>

<p>How can I do this??</p>

<p>This is my onClickListener</p>

<pre><code>lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {

            if (id == view.findViewById(R.id.label).getId()) //label press
            {
                TextView text = (TextView) view.findViewById(R.id.label);
                registerForContextMenu(text);
                openContextMenu(text);
            }
            else //imageButton press
            {
                ImageButton ib= (ImageButton) view.findViewById(R.id.image);
                registerForContextMenu(ib);
                openContextMenu(ib);
            }
         }
       });
</code></pre>
