如何从自定义Android键盘捕获击键 [英] How do I capture keystrokes from a custom Android Keyboard

查看:77
本文介绍了如何从自定义Android键盘捕获击键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在大学心理学系工作。我是一名Android程序员,但我之前从未制作过自定义Android键盘,我认为这是我们下一次学习所需要的。



问题:在Android中创建一个类似于标准美式英语键盘的自定义键盘,但将所有击键记录到日志文件中。 (如果您对此感到担心,请不要这样做;这仅限于同意心理研究参与者,已签署授权,弃权等。我们遵守HIPAA。)



解决方案:创建一个自定义键盘,我很确定我能做到。我计划遵循本教程: http://code.tutsplus。 com / tutorials / create-a-custom-keyboard-on-android - cms-22615 [ ^ ]



一旦我实现了键盘和工作,我如何记录它的击键?我甚至不知道从哪里开始。有什么不同的方法可以实现?你如何捕捉角色值?你如何将这些写入日志文件?



谢谢!

Hi,

I work for a university psychology department. I'm an Android programmer, but I've never made a custom Android keyboard before, and I think that's what we'll need to do for our next study.

Problem: create a custom keyboard in Android that works like a standard American English keyboard, but logs all keystrokes to a log file. (If you're worried about this, don't be; this will be for consenting psych study participants only, who have signed an authorization, waiver, etc. We comply with HIPAA.)

Solution: Create a custom keyboard, which I'm pretty sure I can do. I plan to follow this tutorial: http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615[^]

Once I have the keyboard implemented and working, how do I log keystrokes from it? I don't even know where to start. What are some different ways this could be accomplished? How do you capture the character values? How do you write those to a log file?

Thanks!

推荐答案

你失败了很奇怪即使在阅读了您引用的非常详细的分步教程之后,也可以创建一个工作键盘。即使我在学习某些技术时反对使用一些可用的源代码,你也可以这样做,看看它是如何工作的。其中一篇包含完整代码示例的文章是: http://www.fampennings.nl/maarten/android /09keyboard/index.htm [ ^ ]。



我相信你能找到更完整的样品: http: //bfy.tw/VUh [ ^ ]。



-SA
It's weird that you failed to create a working keyboard even after reading that really detailed step-by-step tutorial you referenced. Even though I'm against using some available source code when learning some techniques, you could do it and see how it works. One of the articles with complete code sample is this: http://www.fampennings.nl/maarten/android/09keyboard/index.htm[^].

I'm sure you can find more complete samples: http://bfy.tw/VUh[^].

—SA


这篇关于如何从自定义Android键盘捕获击键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆