How do you Override onClick in an Android ImageButton derived class
<p>I've seen this asked a thousand times in a thousand different ways, but still can't get it to work...</p>

<p>I created a class which I've derived from ImageButton. I want to define my "on-click" behavior in the class. </p>

<p>I know I can do something inside my Activity's onCreate like:</p>

<pre><code>myButton b;
b = (myButton)findViewById(R.drawable.mybutton);
b.setOnClickListener(new View.OnClickListener() {
     ...etc...
</code></pre>

<p>but I want to define the code where it should be, <strong>in the derived class</strong>.</p>

<p>I first thought I could define it as:</p>

<pre><code> @Override public void onClick(View v) {
</code></pre>

<p>...but I get an error saying that I can't use "@Override" here because "onClick" isn't in the superclass. (When trying to remove "@Override", it just builds and runs, but never gets called). I've also tried:</p>

<pre><code> @Override public void onClickListener(View v) {
</code></pre>

<p>...and several variants of "implements onClickListener" and "implements OnClickListener" to no avail.</p>

<p>This should be fairly simple - any ideas??</p>
