package fi.jyu.ln.luontonurkka.tools;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by jarno on 10/22/16.
 */

public class SettingsManager {

    private SharedPreferences sp;

    public SettingsManager(Activity activity) {
        sp = activity.getPreferences(Context.MODE_PRIVATE);
    }

    public void setBool(String preference, boolean bool) {
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean(preference, bool);
        editor.commit();
    }

    public boolean getBool(String preference) {
        return sp.getBoolean(preference, false);
    }

}

@@ -134,16 +134,61 @@
 erences;
+%0Aimport android.preference.PreferenceManager;
 %0A%0A/**%0A *
@@ -203,26 +203,22 @@
  by 
-j
+J
 arno 
-on 10/22/
+22.10.
 16
-.
 %0A */
@@ -330,24 +330,113 @@
 activity) %7B%0A
+        PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());%0A
         sp =

Save preferences to application context