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

相关文章:

  • 2022-12-23
  • 2022-01-10
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案