|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.system.KeyHandlerRegistry
public class KeyHandlerRegistry
This class allows an application to register as a handler for global key events. A KeyListener added to an Application which has registered with this API will receive key events for a registered key regardless of what another application running in the foreground may do in terms of processing the event. Note that RIM reserves the right to reserve usage of otherwise supported keys to certain native applications. This means that registration may fail for this reason or that an application registered using this registry may become de-registered at a later time if the key in question becomes a restricted key as a result of a native application gaining exclusive control over the key.
Method Summary | ||
---|---|---|
|
static boolean |
isKeySupported(int key)
Determines whether a specified key is a supported global key |
|
static void |
register(Application app,
int key)
Allows an Application to register to receive global key events, regardless of whether a given event is consumed by a foreground process. |
|
static void |
unregister(Application app,
int key)
Unregisters an Application as a handler of global key events |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void register(Application app, int key) throws IllegalArgumentException, KeyHandlerRegistryException
KeyListener
to itself. Applications should use
{Application.addKeyListener(KeyListener, boolean)
and specify true for the boolean parameter so as not to receive duplicate events
should a foreground application fail to consume a given key event.
This API is intended for use by background apps, therefore an exception will be thrown if the application being registered is capable of
obtaining the foreground. For example, Applications that extend a class that can obtain the foreground (e.g. UiApplication
) need to override
the Application.acceptsForeground()
method to return false.
It is possible that a native application has reserved the right to use a global key for its exclusive use. In this case
registration will fail with a KeyHandlerRegistryException. It is also possible that a native application will gain exclusive control over a global key
subsequent to an application being registered with this method in which case the application will be de-registered.
app
- The application to be registeredkeys
- The global key to register the application for. See Keypad
.
IllegalArgumentException
- Thrown if specified key is not a supported global key or if app can accept foreground
KeyHandlerRegistryException
- Thrown if specified key has been reserved for exclusive use by another application
NullPointerException
- If app
paramater is nullpublic static void unregister(Application app, int key)
app
- The application to be unregisteredkeys
- The global key to unregister. See Keypad
.public static boolean isKeySupported(int key)
key
- The key to check for KeyHandlerRegistry
support
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal