Android: onKeyUp and onKeyDown?
<p>I'm having trouble understanding onKeyUp and onKeyDown...<br />
I have an app that resembles a DialPad with imagebuttons rendered. Everytime a button is clicked a sound plays, for instance if imagebutton 0 is clicked a sound saying "zero" will be played and during the click the imagebutton background is changed.<br />
Here's an example of how the imagebutton works when its clicked thru the screen...</p>

<pre><code>private synchronized void playSound(int tone) {
    if(mp != null) {
        mp.stop();
        mp.release();

    }
    mp = MediaPlayer.create(this.getApplicationContext(), tone);
    mp.start();
}

private void ButtonClickSound() {
    ImageButton one = (ImageButton) findViewById(R.id.btnOne);
    one.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            playSound(R.raw.mamacita_one);
        }
    });
}
</code></pre>

<p>Now my onKeyDown method looks like this:<br /></p>

<pre><code>    @Override
public boolean onKeyDown(int keyCode, KeyEvent ev) {

    switch (keyCode) {
    case KeyEvent.KEYCODE_0:
        playSound(R.raw.mamacita_zero);         
        return true;
    }
}
</code></pre>

<p>The xml for the button looks like this:<br /></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
</code></pre>

<p></p>

<pre><code>&lt;item 
    android:state_pressed="true" 
    android:drawable="@drawable/green0" /&gt; &lt;!-- pressed --&gt;

&lt;item android:drawable="@drawable/blue0" /&gt; &lt;!-- default --&gt;
</code></pre>

<p></p>

<p>My question is how do I implement onKeyUp and let the imagebutton switch background during the click ???</p>
