getResource Error
<p>every time I call getResources in my main activity it results in an error and the app is forced to quit. This also happens if I call getApplicationContext().getResources() and even in a totally new project in Eclips. Do I need to do anything before the call? Error on AVD with Android 2.1 and LG GW620 with OpenEtna (2.1)</p>

<p>MainActivity.java:</p>

<pre><code>package com.robin.blatest;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;

public class MainActivity extends Activity {

    Resources res = this.getResources();

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
</code></pre>

<p>Manifest.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.robin.blatest"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="7" /&gt;

    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".MainActivity"
                  android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>LogCat:</p>

<pre><code>W/dalvikvm(  229): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime(  229): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(  229): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.robin.blatest/com.robin.blatest.MainActivity}: java.lang.NullPointerException
E/AndroidRuntime(  229):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime(  229):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime(  229):    at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime(  229):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime(  229):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  229):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  229):    at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime(  229):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  229):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(  229):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(  229):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(  229):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  229): Caused by: java.lang.NullPointerException
E/AndroidRuntime(  229):    at android.content.ContextWrapper.getResources(ContextWrapper.java:80)
E/AndroidRuntime(  229):    at com.robin.blatest.MainActivity.&lt;init&gt;(MainActivity.java:9)
E/AndroidRuntime(  229):    at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(  229):    at java.lang.Class.newInstance(Class.java:1479)
E/AndroidRuntime(  229):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime(  229):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime(  229):    ... 11 more
</code></pre>

<p>Cheers Robin</p>

<p><strong>Edit</strong>: Added Code</p>
