Code example for Instrumentation

Methods: sendKeySyncwaitForIdleSync

0
   *  
   * @param action {@code KeyEvent.ACTION_*} code representing key action 
   * @param keyCode character representing key to press, release, etc. 
   */ 
  public void sendKeyEvent(int action, char keyCode) {
    instrumentation.waitForIdleSync();
    try { 
      instrumentation.sendKeySync(new KeyEvent(action, AndroidKeys.keyCodeFor(keyCode)));
    } catch (SecurityException exception) {
      throw new SelendroidException(exception);
    } 
  } 
 
  /** 
   * A convenience wrapper for {@link #sendKeyEvent(int, char)} which takes an {@code AndroidKeys} 
   * object. 
   *  
   * @param action {@code KeyEvent.ACTION_*} code representing key action 
   * @param key {@code AndroidKeys} object representing key to press, release, etc. 
   */ 
  public void sendKeyEvent(int action, AndroidKeys key) {