网友通过本文主要向大家介绍了androidpc遥控器,android遥控器源码,android 遥控器,android红外遥控,android tv 遥控器等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
android 完全解析模拟遥控器按键,android遥控器
public class VirturlKeyPadCtr {
private static Instrumentation mInstrumentation;
public static void RC_ConttrollerAction(final int keyValue) {
/**
* Wrapper-function taking a KeyCode. A complete KeyStroke is DOWN and UP
* Action on a key!
*/
public static void simulateKeystroke(int KeyCode) {
if (mInstrumentation == null) {
mInstrumentation = new Instrumentation();
}
mInstrumentation.sendKeyDownUpSync(KeyCode);
}
}
写一个类工具类到时候方便调用
调用的时候直接
VirturlKeyPadCtr.simulateKeystroke(realCode);
传人的参数为你的遥控器的KEY值,比如返回键就是KeyEvent.KEYCODE_BACK