BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-31-2008, 04:12 AM   #1
anti_virus
New Member
 
Join Date: Feb 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 3
Default Unable to receive keyChar() event

Please Login to Remove!

Hi All,

I am a newbie, so I could be doing a silly mistake.

I want to trap the keyChar() event ( which I understand would provide me with the actual character as per the keyboard of the BB) which I would then like to display to the user.

I was trying a simple code (below) which prepares a J2ME form and subscribes to the keyListener interface. I am getting all the other events except keyChar().

Where am i going wrong here?


import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import net.rim.device.api.system.*;

public class testK extends MIDlet implements KeyListener{

Form form;

public testK() {}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException { }
protected void pauseApp() { }

protected void startApp() throws MIDletStateChangeException {
form = new Form("New Form");
javax.microedition.lcdui.Display.getDisplay(this). setCurrent(form);
Application.getApplication().addKeyListener(this);
}

public boolean keyChar(char key, int status, int time){
form.append("Got Key Char Event" + key);
return false ;
}

public boolean keyDown(int keycode, int time){
return false ;
}

public boolean keyRepeat(int keycode, int time){
return false ;
}

public boolean keyStatus(int keycode, int time){
return false ;
}

public boolean keyUp(int keycode, int time){
return false ;
}

}


Thanks in advance!!
MG
Offline  
Old 03-31-2008, 08:24 AM   #2
bemshaswing
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Default

Try implementing public boolean keyCharUnhandled as well.
Offline  
Old 03-31-2008, 09:44 AM   #3
anti_virus
New Member
 
Join Date: Feb 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 3
Default

Thanks for the pointer.

But I am afraid, even this dosent seem to work.
Offline  
Old 03-31-2008, 09:55 AM   #4
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

looks like you're mixing MIDLet and Rim libraries there...
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 04-01-2008, 12:06 AM   #5
anti_virus
New Member
 
Join Date: Feb 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 3
Default

You are right..

Now I am having another question in my mind, does keyChar() work with MIDlets?
Offline  
Old 05-19-2008, 12:54 AM   #6
ajj_dev@yahoo.com
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 7100
PIN: N/A
Carrier: Sprint
Posts: 31
Default hi i tried ur application but iam not getting any icon in my emulator

hi,
i am trying to mix RIM and Midlet API`s,i even tried ur testk application but iam not getting any icon in the emulator.
can u plz tell me the execution procedure for your testk application?
i modified ur program and implemented main method to bring an icon,now icon is displayed but when i click that icon it throws java.lang.securityException.

really iam getting doubt whether we can mix up both the group of Api`s.

Thanks
ajj_dev
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool picture

Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool

$68.50



13119 Premium High Vacuum Pump Oil; 1 Pint (Single) picture

13119 Premium High Vacuum Pump Oil; 1 Pint (Single)

$36.71



4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4

4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4"ACME inlet

$29.11



Black+Decker HHVK320J00W Extra Dustbuster Handheld Vacuum picture

Black+Decker HHVK320J00W Extra Dustbuster Handheld Vacuum

$25.00



FEBCO 765DBV 3/4in Bronze FNPT Pressure Vacuum Breaker NEW picture

FEBCO 765DBV 3/4in Bronze FNPT Pressure Vacuum Breaker NEW

$89.99



VacPouch - Chamber Vacuum Pouches, 3mil, 500 PACK picture

VacPouch - Chamber Vacuum Pouches, 3mil, 500 PACK

$66.52







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