title: Button setOnClickListener in a ListView
body: <p>I'm trying to get the onclick event of a button inside a listview, but it's not working</p>
  
  <p><strong>fragment_contact.xml</strong></p>
  
  <pre><code>&lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="404dp"
      android:layout_weight="0.64"
      android:orientation="horizontal"
      android:paddingBottom="40dip" &gt;
  
      &lt;ListView
          android:id="@+id/contactlistview"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_gravity="fill"
          android:layout_weight="10"
          android:textSize="5pt"
          android:visibility="visible" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>fragment_contact_content.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:weightSum="1"&gt;
  
      &lt;Button
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="New Button"
         android:id="@+id/btn_edit_contact"
         android:layout_gravity="right" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>FragmentContact.java</strong></p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      view = inflater.inflate(R.layout.fragment_contact, container, false);
  
      ListAdapter adapter_contact = new SimpleAdapter(
                      getActivity(), allcontact,
                      R.layout.fragment_contact_content, new String[]{"name", "level", "function", "phone", "email"},
                      new int[]{R.id.contact, R.id.level, R.id.function, R.id.phone, R.id.email});
  
      listview_contact = (ListView) view.findViewById(R.id.contactlistview);
      listview_contact.setItemsCanFocus(true);
      listview_contact.setAdapter(adapter_contact);
  
      Button btn_edit_contact = (Button) view.findViewById(R.id.btn_edit_contact);
      btn_edit_contact.setOnClickListener( new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              System.out.println("Do something");
          }
      });
  
      return view;
  }
  </code></pre>
  
  <p>I also tried inflating <strong>fragment_contact_content.xml</strong> but the button still does nothing.</p>