title: NullPointerException on Activity Testing Tutorial
body: <p>I am currently trying the activity testing tutorial (<a href="http://developer.android.com/resources/tutorials/testing/activity_test.html" rel="nofollow noreferrer">Found here</a>), and have a problem. It seems that whenever I try to call something inside the UIThread, I get a java.lang.NullPointerException.</p>
  
  <pre><code>public void testSpinnerUI() {
      mActivity.runOnUiThread( new Runnable() {  
          public void run() {  
              mSpinner.requestFocus();
          }  
      });  
  }
  </code></pre>
  
  <p>This gives me:</p>
  
  <blockquote>
    <p>Incomplete: java.lang.NullPointerException</p>
  </blockquote>
  
  <p>and nothing else. I have tried this on two different samples now, with the same result. I tried with a try/catch clause around the mSpinner.requestFocus() call, and it seems that mSpinner is null inside the thread. I have set it properly up with the setUp() function found in the same sample, and a quick assertNotNull( mSpinner ) shows me that mSpinner is in fact not null after the setUp() function. What can be the cause of this?</p>
  
  <p>EDIT; ok, some more testing has been done. It seems that the application that is being tested resets between each test. This essentially makes me have to reinstantiate all variables between each test. Is this normal?</p>