title: How to override the side volume keys outside my android application
body: <p>I would like to disable the side volume buttons so the only way to control the volume will be from a dedicated activity inside my android app.
  I managed to disable it for all my activities by adding the following code:</p>
  
  <pre><code>@Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      Log.d(TAG, "onKeyDown = " + keyCode);
      if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
          return true;
          }
      if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
          return true;
      }
      return super.onKeyDown(keyCode, event);
  </code></pre>
  
  <p>}</p>
  
  <p>But I don't know how to disable it for the activities i start from my app (for example I start the gallery app)!</p>
  
  <p>I know it is possible as 'Volume Locker' app doing similar stuff.</p>