title: contextMenu for list view
body: <p>i am using a list view. I use an adapter to add the items for this list. I am trying to add contextmenu for each item of the list but i have problems for this. </p>
  
  <p>Here is my code</p>
  
  <p>the item list :</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@color/bgActivity"
  android:orientation="horizontal" &gt;
  
  &lt;TextView
      android:id="@+id/tv_name"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="10dp"
      android:textColor="@color/textColorContact"
      android:textSize="20sp"
      android:textStyle="bold" /&gt;
  
  &lt;Button
      android:id="@+id/pick_options"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_marginRight="10dp"
      android:background="@drawable/app_icon"
      android:text="@string/label_options" &gt;
  &lt;/Button&gt;   
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>the list :</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
  
  &lt;ListView
      android:id="@+id/lst_contacts"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:background="@color/bgContactItem" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The menu :</p>
  
  <pre><code>&lt;menu 
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:id="@+id/CtxLblOpc1" android:title="OpcEtiqueta1"&gt;&lt;/item&gt;
  &lt;item android:id="@+id/CtxLblOpc2" android:title="OpcEtiqueta2"&gt;&lt;/item&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>java code :</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_contacts);
  
  // Getting reference to listview
      ListView lstContacts = (ListView) findViewById(R.id.lst_contacts);
  registerForContextMenu(lstContacts);
  }
  
  @Override
      public void onCreateContextMenu(ContextMenu menu, 
                                      View v, 
                                      ContextMenuInfo menuInfo) {
      super.onCreateContextMenu(menu, v, menuInfo);
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.menu_options, menu);
  
  
  }
  
  
  /** Actions for the ContextMenu items */
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    //AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
        case R.id.CtxLblOpc1:
          Toast.makeText(getApplicationContext(), 
                           "Option 1",     
                           Toast.LENGTH_LONG).show();
            return true;
        case R.id.CtxLblOpc2:
          Toast.makeText(getApplicationContext(), 
                           "Option 2", 
                           Toast.LENGTH_LONG).show();
            return true;
        default:
            return super.onContextItemSelected(item);
     }
  }
  </code></pre>
  
  <p>but i not see the contextmenu, please help, thanks</p>