问题
My application in J2ME, I have just changed Emulator Platform to Blackberry JDE 6.0.0 and Device 9800.
After applying above configuration in Netbeans I got MyApp.cod file. I have installed it on my device Blackberry but problem is I used mostly Canvas and I used softkeys for options. Trackball working with Left, UP, Down & Right it's fine. But my soft keys which I provided on canvas it's not working? What I have to make changes in my canvas to use soft keys of blackberry?
Here is code ::
protected void keyPressed(int keyCode) {
action = getGameAction(keyCode);
if(keyCode == -7)
{
// for go to back
Display.getDisplay(midlet).setCurrent(midlet.aolMenuCanvas);
}
else if(keyCode == -6)
{
try {
//midlet.DownloadPhoto((imageName[index_send]),++index_send);
midlet.DownloadPhoto(imgName[index]);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
回答1:
First look at this question and it's accepted answer.In the other hand you can add 2 commands with the same priority to the canvas and handle your changes in commandAction(Command cmnd, Displayable dsplbl)method.If you want that your command's labels be hidden,set canvas full screen mode to true.
来源:https://stackoverflow.com/questions/9373998/how-to-use-soft-keys-in-blackberry-application