I was wondering if I am able to disable the default volume up and down key press on the side of a cell phone.
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Log.v("key pressed", String.valueOf(event.getKeyCode()));
return false;
//return super.dispatchKeyEvent(event);
}
I am using dispatchKeyEvent
to find when the user presses the volume up or down button but I am not able to stop the phone from actually turning up the volume or turning it down. I want to enable the user to fire methods in my application if they decide to use the volume up or down button. Am I able to stop the phone from performing the volume control when my application is focused?