android volume keys issue
<p>i have the following code:</p>

<pre><code>@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    int action = event.getAction();
    int keyCode = event.getKeyCode();
        switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_UP:
            if (action == KeyEvent.ACTION_UP) {
                int currentVolume = 0;
                currentVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
                if(currentVolume != 15){
                    audio.setStreamVolume(AudioManager.STREAM_MUSIC, currentVolume+1, 0);
                }
                volumeSlider.setProgress(currentVolume+1);

            }
            return true;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            if (action == KeyEvent.ACTION_DOWN) {
                int currentVolume = 0;
                currentVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC);
                if(currentVolume != 0){
                    audio.setStreamVolume(AudioManager.STREAM_MUSIC, currentVolume-1, 0);
                }
                volumeSlider.setProgress(currentVolume-1);
            }
            return true;
        default:
            return super.dispatchKeyEvent(event);
        }
    }
</code></pre>

<p>I have the following issue, with this code my app allows me to hold the volume down key and keeps reacting, however when i press and hold the volume up key on my device my code only gets triggered once.</p>

<p>Why is this? am i doing something wrong?</p>

<p>regards</p>
