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