Basic ImageButton onClick event not firing - surely something simple?
<p>I'm trying to get a simple onClick to fire from an ImageButton - it seems like a simple enough task, but I'm obviously missing something here.</p>

<p>Here is my java file:</p>

<pre><code>package com.jlbeard.android.testapp;  
import android.app.Activity;  
import android.os.Bundle;  
import android.view.View;  
import android.view.View.OnClickListener;  
import android.widget.ImageButton;  
import android.widget.Toast;  

public class testapp extends Activity {  
/** Called when the activity is first created. */  
@Override  
public void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.main);  

    //handle the button press
    ImageButton mainButton = (ImageButton) findViewById(R.id.mainButton);
    mainButton.setOnClickListener(new OnClickListener() {

     @Override
        public void onClick(View v) {
      //show message
      Toast.makeText(testapp.this, "Button Pressed", Toast.LENGTH_LONG);

     }
    });
}
}
</code></pre>

<p>Here is my layout file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
&gt;

  &lt;ImageView
  android:id="@+id/whereToEat"
  android:src="@drawable/where_to_eat"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
  android:layout_marginTop="8px"
  /&gt;

 &lt;ImageButton
  android:id="@+id/mainButton"
  android:src="@drawable/main_button"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
  android:layout_centerVertical="true"
  android:background="@null"
  android:clickable="true"
  android:onClick="mainButtonClick"
  /&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>It seems to me that I'm missing something simple... but can't seem to figure it out. Thanks!</p>
