Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Administrator
MSohm
Posts: 14,446
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Inject KeyCodeEvent

I was testing this with the phone application already in the foreground.  Part of the issue is the fact that the events are being injected before the phone application has focus.  To work around that you can add a delay (Thread.sleep) in the thread that is running this code.

 

You'll also need to use EventInjector.invokeEvent method instead of calling post.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
BlakberryNewbie
Posts: 35
Registered: ‎09-11-2008
My Device: Not Specified

Re: Inject KeyCodeEvent

Thanks Mark. That did the trick. It was the timing issue. The Thread.sleep command fixed everything.
Please use plain text.