in the following 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;
}
}
getContentResolver() causes a NullPointerException. Why ?
I find this exception especially confusing because Google states "You get a ContentResolver by calling getContentResolver() from within the implementation of an Activity or other application component"
http://developer.android.com/guide/topics/providers/content-providers.html