title: Button does not respond to onClick event
body: <p>Hi everyone I ve been searching this a lot but I couldn't find an answer that would work in my case. In my layout i have a listview and outside the list and more specific above i have an imageview an editText which work as a search and a custom Button!The problem is that when i press the button does not start the Activity which i have put in th Intent.Why is this happening?I cannot find the error and so far i had never problem with button events.
  Here is my xml:
      
      </p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/linearLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/imageView1"
      android:orientation="vertical" &gt;
  
      &lt;ListView
          android:id="@+id/list"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:clickable="false"
          android:layout_below="@+id/autoCompleteTextView1" &gt;
      &lt;/ListView&gt;
  &lt;/LinearLayout&gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:text="LIST OF PATIENTS"
      android:textAppearance="?android:attr/textAppearanceMedium"
      android:textColor="#33B5E5" /&gt;
  
  &lt;ImageView
      android:id="@+id/imageView1"
      android:layout_width="90dp"
      android:layout_height="85dp"
      android:layout_alignLeft="@+id/linearLayout1"
      android:layout_below="@+id/textView1"
      android:padding="2dp"
      android:src="@drawable/search_user" /&gt;
  
  &lt;LinearLayout
      android:id="@+id/linear"
      android:layout_width="60dp"
      android:layout_height="60dp"
      android:layout_alignBottom="@+id/autoCompleteTextView1"
      android:layout_alignParentRight="true"
      android:orientation="vertical" &gt;
  
      &lt;Button
      android:id="@+id/add"
      android:layout_width="60dp"
      android:layout_height="60dp"
      android:layout_above="@+id/linearLayout1"
      android:layout_alignParentRight="true"
      android:background="@drawable/buttonadd"
      android:onClick="button_click"
      android:src="@drawable/add" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;AutoCompleteTextView
      android:id="@+id/autoCompleteTextView1"
      android:layout_width="280dp"
      android:layout_height="wrap_content"
      android:layout_alignBottom="@+id/imageView1"
      android:layout_toLeftOf="@+id/linear"
      android:ems="10"
      android:hint="Search patient" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>the button is the right on the top next to autocomplete.In the .java doc i have right this code as far as concerned the button:
  In the onCreate</p>
  
  <pre><code>addp=(Button) findViewById(R.id.add);
  addp.setOnClickListener(this);
  </code></pre>
  
  <p>In th onClick</p>
  
  <pre><code>case R.id.add:
      Intent add= new Intent(sqlviewpatients.this,afprognosis.class);             
      startActivity(add);
      break;
  </code></pre>
  
  <p>I ve been doing the same thing to others button and they working only this one does not respond to onClick events.Please tell me what I am doing wrong?
  thanks in advance</p>