title: android testing - EditText returning empty even when it has characters
body: <p>I'm trying to perform a functional test on an EditText, sending text to it by first gaining focus on the field using the following snippet:</p>
  
  <pre><code>instrumentation.runOnMainSync(new Runnable() {
      @Override
      public void run() {
           editText.requestFocus();
      }
  }
  </code></pre>
  
  <p>and then sending the string via:</p>
  
  <pre><code>instrumentation.waitForIdleSync();
  instrumentation.sendStringSync("Some Text");
  instrumentation.waitForIdleSync();
  </code></pre>
  
  <p>If I run the test and watch it, the text is really being input into the EditText, but when I try to get it for use in an assertion, the EditText returns an empty text:</p>
  
  <pre><code>assertFalse(editText.getText().toString().isEmpty());
  </code></pre>
  
  <p>I've tried logging the text, but it really returns an empty string, as if there is no text in the EditText. I have also tried running the assertion on a separate Runnable or after a certain delay to no avail.</p>
  
  <p><b>Temporary solution:</b>
  As for the meantime, I'm passing the test by manually adding</p>
  
  <pre><code>editText.setText("Some Text");
  </code></pre>
  
  <p>before the assertion, though I think there could be a better or correct way.</p>