why does getContentResolver() within Application cause NullPointerException?
<p>in the following code:</p>

<pre><code>public class ApplicationContext extends Application
{

    private static ApplicationContext instance;

    public ApplicationContext()
    {
        instance = this;
        final String strID = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    }

    public static Context getContext()
    {
        return instance;
    }
}
</code></pre>

<p>getContentResolver() causes a NullPointerException. Why ?</p>

<p>I find this exception especially confusing because Google states <em>"You get a ContentResolver by calling getContentResolver() from within the implementation of an Activity or other application component"</em></p>

<p><a href="http://developer.android.com/guide/topics/providers/content-providers.html" rel="nofollow">http://developer.android.com/guide/topics/providers/content-providers.html</a></p>
