Code example for Instrumentation

Methods: runOnMainSyncsendStringSync

   * @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() {
      public void run() { 
    // 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);" 
    return editText.getText().toString();
   * Taps the specified preference displayed by the provided Activity.