I am developing an Android Application, for keep me logged in functionality I am using SharedPreferences application started to crash.
This is the line that i add for Preferences;
SharedPreferences pref = getApplicationContext().getSharedPreferences("RS_Remember" , getApplicationContext().MODE_PRIVATE);
I am pretty sure that this line is causing error because it works fine if i remove it.
Error message i get says:
java.lang.Runtime: Unable to create application com.x.x.x : java.lang.NullPointerException.
Any idea abot what i shuold do?
Edit
public Activity activity;
    SharedPreferences pref;
    private RSCurrentUserManager()
    {
        super();
            pref = this.activity.getSharedPreferences("RallySpark_Remember",0);
    }
+05-09 18:02:56.221: E/AndroidRuntime(31760): FATAL EXCEPTION: main
+05-09 18:02:56.221: E/AndroidRuntime(31760):
 java.lang.RuntimeException: Unable to create application
 com.x.x.general.RSApplication:
 java.lang.NullPointerException
+05-09 18:02:56.221:
 E/AndroidRuntime(31760):   at
 com.x.x.general.RSCurrentUserManager.<init>(RSCurrentUserManager.java:93)
+05-09 18:02:56.221: E/AndroidRuntime(31760):   at com.x.x.general.RSCurrentUserManager.getInstance(RSCurrentUserManager.java:84)
I am not using Shared preferences in any other pleace in order to find the problem i removed everything execpt its defination
 
     
     
    