通过Runtime实现模拟按键,但速度很慢。
用Instrumentation效果不错
new Thread () {
public void run () {
try {
Instrumentation inst=new Instrumentation();
inst.sendKeyDownUpSync(4);
} catch(Exception e) {
Log.e("Exception when sendPointerSync", e.toString());
}
}
}.start();