BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-24-2008, 05:04 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Problem with EventInjection or KeyCode....

Please Login to Remove!

I was trying to implement Loudspeaker in my application...

I tried the following code..

But instead of invoking the Loudspeaker its invoking the mute feature.

I think its happening because of the difference in the device series.

I mean those with 38,34,30,24,and 23 character keypad..

Can anybody suggest a method to implement this feature in such a way that it will work in all the devices?

code:

EventInjector.KeyCodeEvent pressEndKey = new EventInjector
.KeyCodeEvent( KeyCodeEvent.KEY_DOWN, (char)Keypad
.KEY_SPEAKERPHONE, KeypadListener.STATUS_NOT_FROM_KEYPAD, 100);

EventInjector.KeyCodeEvent releaseEndKey = new EventInjector
.KeyCodeEvent( KeyCodeEvent.KEY_UP, (char)Keypad
.KEY_SPEAKERPHONE, KeypadListener.STATUS_NOT_FROM_KEYPAD, 100);

EventInjector.invokeEvent(pressEndKey);
EventInjector.invokeEvent(releaseEndKey);
Offline  
Old 04-25-2008, 09:09 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

is there any way to get the keycode dynamically?

If i write keypad.KEY_END or some other constant, i think its depended on the JVM used for buildind the application than the one is used by the device...

When i am overriding a keydown() method, its keycode parameter type is int but i am getting a seven digit number...

is there any way to get the keychar or key name form this keycode?
Offline  
Old 04-25-2008, 09:45 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had the same problem with keydown().
the keycode that should be processed if I pressed the END - key in the simulator has the value: 0x00120000 , but the value of Keypad.KEY_END is 0x00000012.

The solution I was told is to convert the keycode:
Code:
int keyValue = Keypad.key( keycode );
if (keyValue == Keypad.KEY_END)
{
  //... DO SOMETHING ...
}
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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