BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-29-2009, 06:07 AM   #1 (permalink)
New Member
 
Join Date: Jun 2009
Model: 8100
PIN: N/A
Carrier: airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Green key press programatically

Please Login to Remove!

Hi,
I have tired with below code but i could not able to press the green key .Please help me where am i wrong?
Quote:
EventInjector.KeyCodeEvent pressEndKey = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEv ent.KEY_DOWN,
(char)Keypad.key(1114112), KeypadListener.STATUS_NOT_FROM_KEYPAD,100);
EventInjector.KeyCodeEvent releaseEndKey = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEv ent.KEY_UP,
(char)Keypad.key(1114112), KeypadListener.STATUS_NOT_FROM_KEYPAD,100);
EventInjector.invokeEvent(pressEndKey);
EventInjector.invokeEvent(releaseEndKey);
Thanks,
Offline  
Old 08-18-2009, 06:53 AM   #2 (permalink)
New Member
 
Join Date: Jul 2009
Model: 8130
PIN: N/A
Carrier: Mobilink
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

For giving programatically permission your should do the following settings:
Go to Options -> Advanced Options -> Applications > Press Menu key > Modules > select your application > Press Menu key > Edit Permissions > Expand Interaction option-> set to allow keystrokeinjection permission.

Then try this piece of code:
EventInjector.KeyCodeEvent pressEndKey = new
EventInjector.KeyCodeEvent(
KeyCodeEvent.KEY_DOWN,( char)
Keypad.KEY_SEND,0,100);

EventInjector.KeyCodeEvent releaseEndKey =
new EventInjector.KeyCodeEvent(
KeyCodeEvent.KEY_UP,(char)
Keypad.KEY_SEND,0,100);

try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EventInjector.invokeEvent(pressEndKey);
EventInjector.invokeEvent(releaseEndKey);
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.