How to use Soft Keys in Blackberry Application?

两盒软妹~` 提交于 2019-12-11 04:43:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!