Null pointer exception while setting android context to application object
Hello,
I am trying to connect from android to sup server. But I am getting a different kind of issue. For the first time if i were run the application getting an exception saying connection properties null but from the second time onwards getting a null pointer exception at the line “app.setApplicationContext(getApplicationContext());”. and below is the exception from second time onwards.
Exception:
Exception Ljava/lang/NullPointerException; thrown while initializing Lcom/sybase/messaging/common/ClientConfig;
My code:
Application app = Application.getInstance();
app.setApplicationIdentifier(“sampleone”);
app.setApplicationContext(getApplicationContext());
Manifest file:
<uses-sdk
android:minSdkVersion=”8″
android:targetSdkVersion=”18″ />
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.READ_PHONE_STATE” />
<uses-permission android:name=”android.permission.CHANGE_WIFI_STATE” />
<uses-permission android:name=”android.permission.ACCESS_WIFI_STATE” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
I am sure that the problem is not with the code but with the configurations. But I could not able to find it out where exactly the issue is. I have tried even downloading a sample project “SUP101” getting the same error.
Can any body help me in this regard.
Thanks,
Hi Gupta,
I would recommend you to create the Question in the "questions" tab, where people can help you with the issue. You have actually created the Blog post.
Kind regards!