BlackBerry Programming - Surround Hardware Buttons

Is there a way to find out if users will press one of the two hardware volume keys on the side of the phone?

+4
source share
1 answer

In the MainScreen or FullScreen class, override the following method:

protected boolean keyControl(char key, int status, int time) { switch (key) { case Characters.CONTROL_VOLUME_UP: // Do something return true; case Characters.CONTROL_VOLUME_DOWN: // Do something return true; default: return super.keyCharUnhandled(key, status, time); } } 

The caveat is that this only works when your application and this screen are in the foreground. If you want to allow users to use the volume keys when your application is in the background, you need to use the BlackBerry Media Actions API , which is available only in version 5.0 and higher.

+6
source

All Articles