Hi well im trying to build an android app with account features using JSON with MYSQL. I was able to login but whenever I log out it causes a crash

code snippet for onclick event

```
public void onClick(DialogInterface dialog,int which) {
                    UserFunctions logout = new UserFunctions();
                    logout.logoutUser(getActivity());

```

Here is my logout function from my userfunctions class

```
public boolean logoutUser(Context context){
        // Clearing all data from Shared Preferences
        editor.clear();
        editor.commit();

        // After logout redirect user to Loing Activity
        Intent i = new Intent(_context, Login.class);
        // Closing all the Activities
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        // Add new Flag to start new Activity
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        // Staring Login Activity
        _context.startActivity(i);

        return true;

```

Logcat Report

```
09-22 16:47:11.278: E/AndroidRuntime(1455): FATAL EXCEPTION: main
09-22 16:47:11.278: E/AndroidRuntime(1455): Process: com.learn2crack.tab, PID: 1455
09-22 16:47:11.278: E/AndroidRuntime(1455): java.lang.NullPointerException
09-22 16:47:11.278: E/AndroidRuntime(1455):     at com.learn2crack.library.UserFunctions.logoutUser(UserFunctions.java:115)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at com.learn2crack.tab.Profile$2.onClick(Profile.java:92)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at android.os.Handler.dispatchMessage(Handler.java:102)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at android.os.Looper.loop(Looper.java:136)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at android.app.ActivityThread.main(ActivityThread.java:5017)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at java.lang.reflect.Method.invokeNative(Native Method)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at java.lang.reflect.Method.invoke(Method.java:515)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
09-22 16:47:11.278: E/AndroidRuntime(1455):     at dalvik.system.NativeStart.main(Native Method)

```

I have done some more searching for answers and came up with adding this code

```
public SessionManager(Context context){
        this._context = context;
        pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
        editor = pref.edit();
    }

```

But the PREF\_NAME, PRIVATE\_MODE are having the error line it says it cannot be resolved into a variable but the example I read didn't require any declaration