如何创建访问低级硬件的黑莓应用程序?
我已经编写了一些黑莓应用程序,但现在我正在尝试编写一个必须以某种低级方式访问硬件(键盘)的应用程序,但我似乎找不到一种方法来做到这一点,也没有任何帮助在“官方”板上。
问题是,我需要知道何时在黑莓键盘中按下“$”键,以便我的应用程序(或常驻服务)可以捕获它,停止显示“$”字符,并且如果用户接下来按下一个元音,然后在该元音上添加一个重音...如果按下另一个键,只需发回“$”字符+另一个字符。
即 '$' + 'a' = á
换句话说,我需要创建一个应用程序或服务将 '$' 键转换为重音键,就像典型的非美国 PC 键盘的工作原理一样。
现在问题来了:整个 Blackberry 操作系统在 Java 虚拟机下工作(有点像让 JVM 成为实际的操作系统)。正如您可以想象的那样,为其编写的每个应用程序都是用 Java 编写的。
显然,他们的 Java 实现中有一组特殊的黑莓 api 库,因此开发人员能够访问特定的黑莓功能和特性……但是,似乎没有什么东西可以用来完成我的特定任务。
但也许有,但我还没有找到它,因为我对黑莓编程还是新手。
因此,在此说明中,我们将不胜感激任何帮助或评论。
-加布里埃尔·阿隆索。
I've written some BlackBerry apps, but now i'm trying to write one that must access the hardware (keyboard) in some low level way, and I can't seem to find a way to do it, nor any help to it in the 'official' boards.
The thing is, I need to know when, at any time, the '$' key is pressed in the blackberry keyboard, so my app (or resident service) can catch it, stop the '$' char from displaying, and if the user presses a vowel next, then add an accent to that vowel... and if it presses another key, just send back the '$' char + the other char.
i.e. '$' + 'a' = á
In other words, I need to create an app or service that converts the '$' key into an accent key, just like typical non-US PC keyboards works.
Now here's the problem: The whole Blackberry OS works under a Java Virtual Machine (Kind of making the JVM the actual OS). So as you can imagine, every app written for it is written in Java.
There's obviously a set of special blackberry api libraries into their Java implementation so the developer is able to access particular Blackberry functions and features... however there doesn't seem to be a thing that I can use to achieve my particular task.
But then maybe there is, and I haven't found it, since I'm still new to Blackberry Programming.
So, in that note, any help or comment will be greatly appreciated.
-Gabriel Alonso.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
屏幕需要有焦点才能获取关键事件。
出于安全原因,RIM 不允许对其硬件进行低级别访问。
按住字母键并滚动拇指轮可滚动浏览国际/重音字符、方程式符号和其他标记。
这是来源
A screen need to have the focus to be able to get key Event.
RIM dosen't allow low level access to their hardware for security reason.
Press and hold a letter key and roll the thumb-wheel to scroll through international/accent characters, equation symbols and other marks.
Here is the source
黑莓不允许执行应用程序,如果它们使用某些API,更不用说低级编程了。
您可以在应用程序中使用的所有键盘处理功能 - 都是 Java 的可能性。就像KeyListener接口和Keypad类一样。
Blackberry do not allow execute applications, if they use certain API, not to mention the low-level programming.
All that you can use in your applications for keypad handling - it is possibilities of Java. Like KeyListener interface and Keypad class.
然而,这是一个很晚的答复...
您可以使用 keyChar (屏幕和 KeyListenerInterface 的成员)来拦截任何键 - 对于第一个字母,捕获按下的键。如果它是“$”,则保留它并且不调用 super.keyChar。如果之前按下了 $,则在下一个 keyChar 上(或在没有输入的延迟之后)执行映射,并将您设计的字符代码发送到 super.keyChar 调用。如果 keyChar 存在实现问题,则可以类似地使用 keyDown 和 keyUp。
This is a very late reply, however...
You can use keyChar (member of screen, and of KeyListenerInterface) to intercept any key - for the first letter, capture the key pressed. If it's "$" hold onto it and don't call super.keyChar. On the next keyChar (or after a delay with no input) perform your mapping if $ was previously pressed, and send your designed character code to the super.keyChar call. keyDown and keyUp can be used similarly if keyChar presents implementation issues.