title: Google's Android HelloWorldTest fail - receives null pointer on retrieving resource
body: <p>I'm using the HelloAndroidTest tutorial from Google: </p>
  
  <p><a href="http://developer.android.com/resources/tutorials/testing/helloandroid_test.html" rel="nofollow">http://developer.android.com/resources/tutorials/testing/helloandroid_test.html</a>. </p>
  
  <p>Here's the test class:</p>
  
  <pre><code>package com.example.helloandroid.test;
  
  import com.example.helloandroid.HelloAndroid;
  
  import android.test.ActivityInstrumentationTestCase2;
  import android.widget.TextView;
  
  public class HelloAndroidTest extends
          ActivityInstrumentationTestCase2&lt;HelloAndroid&gt; {
  
      private HelloAndroid mActivity;
      private String resourceString;
      private TextView mView;
  
      public HelloAndroidTest() {
          super("com.example.helloandroid", HelloAndroid.class);
      }
  
  
      protected void setUp(TextView mView) throws Exception {
          super.setUp();
          mActivity = this.getActivity();
          mView = (TextView) mActivity
                  .findViewById(com.example.helloandroid.R.id.textview);
          resourceString = mActivity
                  .getString(com.example.helloandroid.R.string.hello);
      }
  
      public void testPreconditions() {
          assertNotNull(mView);       // &lt;== always null
          //System.out.println("Resourse string: " + resourceString);
          //assertNotNull(resourceString); // &lt;== always null (when run)
      }
  
      public void testText() {
          assertEquals(resourceString, (String) mView.getText());
      }
  }
  </code></pre>
  
  <p>Here's the HelloAndroid class:</p>
  
  <pre><code>package com.example.helloandroid;
  
  
  import android.app.Activity;
  
  import android.os.Bundle;
  
      public class HelloAndroid extends Activity {
          /** Called when the activity is first created. */
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
          }
      }
  </code></pre>
  
  <p>This is main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView android:id="@+id/textview" xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="@string/hello"/&gt;
  </code></pre>
  
  <p>And strings.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;string name="hello"&gt;Hello Android!&lt;/string&gt;
      &lt;string name="app_name"&gt;Hello, Android&lt;/string&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>Both mView and resource string fail their respective notNull tests.</p>
  
  <p>This is pretty basic, but it does require an activity to be successfully created and the resource pulled from the HelloAndroid project, which is the functionality I need to get on with unit testing. Any ideas on how to fix this? </p>