title: Android listview onItemClickListener doesn't work
body: <p>Please excuse my English, I'm French !</p>
  
  <p>I've got a listview, and I want to display an other activity on click on an item.
  But the onItemClickListener seems to doesn't work...
  I searched on Google, but but I found nothing.</p>
  
  <p>Here my code:</p>
  
  <p><strong>The XML listView (custom) :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/activity_advert_list_listview"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@color/background" &gt;
  
  &lt;RelativeLayout
      android:id="@+id/advertBackground"
      android:layout_width="339dp"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginBottom="7.5dp"
      android:layout_marginTop="7.5dp"
      android:background="@drawable/background_advert_list" &gt;
  
      &lt;RelativeLayout
          android:id="@+id/advertImageLayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="8dp" &gt;
  
          &lt;RelativeLayout
              android:id="@+id/advertBackgroundLayout"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:background="@color/grey" &gt;
  
              &lt;ImageView
                  android:id="@+id/advertImage"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/advertPriceLayout"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/advertImage"
              android:layout_marginTop="-30.5dp"
              android:background="@color/white_50" &gt;
  
              &lt;TextView
                  android:id="@+id/advertPriceText"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerHorizontal="true"
                  android:hint="@string/Price"
                  android:paddingBottom="5dp"
                  android:paddingLeft="7dp"
                  android:paddingRight="7dp"
                  android:paddingTop="3dp"
                  android:textSize="14dp"
                  android:textStyle="bold" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;RelativeLayout
          android:id="@+id/advertInfosLayout"
          android:layout_width="305dp"
          android:layout_height="47dp"
          android:layout_below="@+id/advertImageLayout"
          android:layout_centerHorizontal="true"
          android:layout_marginBottom="10dp"
          android:layout_marginTop="10dp" &gt;
  
          &lt;RelativeLayout
              android:id="@+id/advertInfosLayoutLayout"
              android:layout_width="225dp"
              android:layout_height="wrap_content"
              android:layout_below="@+id/advertImageLayout" &gt;
  
              &lt;TextView
                  android:id="@+id/advertTitleText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:hint="@string/Product_name"
                  android:textColor="@color/grey_blue"
                  android:textSize="15sp"
                  android:textStyle="bold" /&gt;
  
              &lt;TextView
                  android:id="@+id/advertSizeText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/advertTitleText"
                  android:hint="@string/Product_infos"
                  android:textColor="@color/b4b5b6"
                  android:textSize="15sp" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/advertBookmarkLayout"
              android:layout_width="74dp"
              android:layout_height="45dp"
              android:layout_toRightOf="@+id/advertInfosLayoutLayout" &gt;
  
              &lt;Button
                  android:id="@+id/advertBookmarkIcon"
                  android:layout_width="26dp"
                  android:layout_height="26dp"
                  android:layout_centerVertical="true"
                  android:background="@drawable/bookmark" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/advertDistanceLayout"
              android:layout_width="50dp"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true" &gt;
  
              &lt;Button
                  android:id="@+id/advertDistanceIcon"
                  android:layout_width="26dp"
                  android:layout_height="26dp"
                  android:layout_centerHorizontal="true"
                  android:background="@drawable/distance" /&gt;
  
              &lt;TextView
                  android:id="@+id/advertDistanceText"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/advertDistanceIcon"
                  android:layout_centerHorizontal="true"
                  android:text="13 km"
                  android:textColor="@color/grey_midark"
                  android:textSize="11sp" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>The Java code :</strong></p>
  
  <pre><code>    list.setOnItemClickListener(new OnItemClickListener() {
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
          // Start new detail activity
          Intent intent = new Intent(activity, AdvertDetailActivity.class);
          startActivity(intent);
  
          Log.w("AdvertList", "Item clicked");
      }
  });
  </code></pre>
  
  <p>Have you got an idea ?
  Thanks a lot !</p>