Runtime error referencing a resource in string.xml
<p>I am getting a Java runtime exception when I reference a resource from string.xml.  I read "String Resources" and "Accessing Resources" on the Android developer website and still don't know why these are wrong.  Thanks so much for your help!</p>

<p>In string.xml:</p>

<pre><code>    &lt;string name="fAudioRecorderDir"&gt;AudioRecorder&lt;/string&gt;
</code></pre>

<p>In Java: (this is line 26 of upload that got NullPointerException)</p>

<pre><code>    final String homeDir = Environment.getExternalStorageDirectory().getPath() + "/" + getResources().getString(R.string.fAudioRecorderDir) + "/";
</code></pre>

<blockquote>
  <h2>From Logcat ##</h2>
  
  <p>E/AndroidRuntime(14597): FATAL EXCEPTION: main<br>
  E/AndroidRuntime(14597): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.medikin.android.dictaphone/com.medikin.android.dictaphone.Upload}: java.lang.NullPointerException<br>
  E/AndroidRuntime(14597):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)<br>
  E/AndroidRuntime(14597):    at android.app.ActivityThread.startActivityNow(ActivityThread.java:1487)<br>
  E/AndroidRuntime(14597):    at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)<br>
  E/AndroidRuntime(14597):    at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)<br>
  E/AndroidRuntime(14597):    at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)<br>
  E/AndroidRuntime(14597):    at android.widget.TabHost.setCurrentTab(TabHost.java:326)<br>
  E/AndroidRuntime(14597):    at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:132)<br>
  E/AndroidRuntime(14597):    at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456)<br>
  E/AndroidRuntime(14597):    at android.view.View.performClick(View.java:2485)<br>
  E/AndroidRuntime(14597):    at android.view.View$PerformClick.run(View.java:9080)<br>
  E/AndroidRuntime(14597):    at android.os.Handler.handleCallback(Handler.java:587)<br>
  E/AndroidRuntime(14597):    at android.os.Handler.dispatchMessage(Handler.java:92)<br>
  E/AndroidRuntime(14597):    at android.os.Looper.loop(Looper.java:130)<br>
  E/AndroidRuntime(14597):    at android.app.ActivityThread.main(ActivityThread.java:3683)<br>
  E/AndroidRuntime(14597):    at java.lang.reflect.Method.invokeNative(Native Method)<br>
  E/AndroidRuntime(14597):    at java.lang.reflect.Method.invoke(Method.java:507)<br>
  E/AndroidRuntime(14597):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)<br>
  E/AndroidRuntime(14597):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)<br>
  E/AndroidRuntime(14597):    at dalvik.system.NativeStart.main(Native Method)<br>
  E/AndroidRuntime(14597): Caused by: java.lang.NullPointerException<br>
  E/AndroidRuntime(14597):    at android.content.ContextWrapper.getResources(ContextWrapper.java:80)<br>
  E/AndroidRuntime(14597):    at com.medikin.android.dictaphone.Upload.(Upload.java:26)<br>
  E/AndroidRuntime(14597):    at java.lang.Class.newInstanceImpl(Native Method)<br>
  E/AndroidRuntime(14597):    at java.lang.Class.newInstance(Class.java:1409)<br>
  E/AndroidRuntime(14597):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)<br>
  E/AndroidRuntime(14597):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)<br>
  E/AndroidRuntime(14597):    ... 18 more<br>
  W/ActivityManager(   68):   Force finishing activity com.medikin.android.dictaphone/.Dictaphone</p>
</blockquote>
