Code example for Instrumentation

Methods: runOnMainSyncsendStringSync

0
   * 
   * @return the resulting string read from the editText - this should equal text. 
   */ 
  public static String enterText(
      Instrumentation instr, final EditText editText, final String text) {
    instr.runOnMainSync(new Runnable() {
      @Override 
      public void run() { 
        editText.requestFocus();
      } 
    }); 
    // TODO(sarvar): decide on using touch mode and how to do it consistently. e.g., 
    //               the above could be replaced by "TouchUtils.tapView(this, editText);" 
    instr.sendStringSync(text);
    return editText.getText().toString();
  } 
 
  /** 
   * Taps the specified preference displayed by the provided Activity. 
   */ 
  public static void tapPreference(InstrumentationTestCase instrumentationTestCase,