如何在黑莓应用程序中使用软键?
我在 J2ME 中的应用程序,我刚刚将模拟器平台更改为 Blackberry JDE 6.0.0 和设备 9800。
在 Netbeans 中应用上述配置后,我得到了 MyApp.cod 文件。我已将其安装在我的 Blackberry 设备上,但问题是我主要使用 Canvas,并且使用软键作为选项。轨迹球可与“左”、“上”、“下”和“左”一起使用。对了就没事了。但是我在画布上提供的软键不起作用?我必须在画布上进行哪些更改才能使用黑莓的软键?
这是代码:::
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();
}
}
}
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();
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先看看这个问题,它是被接受的答案。另一方面
您可以向画布添加 2 个具有相同优先级的命令,并在 commandAction(Command cmnd, Displayable dsplbl) 方法中处理您的更改。如果您希望隐藏命令的标签,请将画布全屏模式设置为 true。
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.