Android ez 2013-06-21
利用 sendKeyDownUpSync 模擬使用者按下鍵盤。
public boolean KeyUP() {
Instrumentation m_Instrumentation = new Instrumentation();
m_Instrumentation.sendKeyDownUpSync( KeyEvent.KEYCODE_DPAD_UP );
return true;
}
public boolean KeyDOWN() {
Instrumentation m_Instrumentation = new Instrumentation();
m_Instrumentation.sendKeyDownUpSync( KeyEvent.KEYCODE_DPAD_DOWN );
return true;
}
public boolean KeyLEFT() {
Instrumentation m_Instrumentation = new Instrumentation();
m_Instrumentation.sendKeyDownUpSync( KeyEvent.KEYCODE_DPAD_LEFT );
return true;
}
public boolean KeyRIGHT() {
Instrumentation m_Instrumentation = new Instrumentation();
m_Instrumentation.sendKeyDownUpSync( KeyEvent.KEYCODE_DPAD_RIGHT );
return true;
}標籤: Android
