How to override the behavior of the volume buttons in an Android application?

android

Solution

I imagine it looks something like this:

public boolean onKeyDown(int keyCode, KeyEvent event) 
{ 
   if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) { 
       // Do your thing 
       return true;
   } else {
       return super.onKeyDown(keyCode, event); 
   }
}

Problem

I'd like to use the volume buttons for something else in my Android application. The Dolphin browser does this I am told. Anyone know how?

Original source