Volume up button = touching screen


I’m trying to develop a very simple app where everytime I press the screen, an action is taken (picture changes, etc etc…)

Can I also assign this fuction to the volume up button? In other words, can “touch the screen” and pressing volume up button do the same?

I explain why I have this question. I would like to remote control my app using the bluetooth remote control of the new selfie sticks. If I assign that option to the volume button (which is the one that the bluetooth remote deals with) can I create an action using the already built selfy bluetooth remote?

Is this possible for Android?

Before I start exploring code, I would like to know if it is possible.

I thank you in advance for your time.



Yes, you can override the default volume button actions:

public boolean onKeyDown(int keyCode, KeyEvent keyEvent) 
   if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { 
       // change picture or whatever

       return true;
   } else {
       return super.onKeyDown(keyCode, event);