package com.moonshot.dev4x.helpers;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
/**
* Created by hirendave on 8/14/15.
*/
public class SharedPreferencesHelper {
private Context context;
public SharedPreferencesHelper(Context context) {
this.context = context;
}
public void savePreferences(String key, String value) {
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(context);
Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
}
public String getPreferenceValue(String key){
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(context);
return sharedPreferences.getString(key, null);
}
public void removePreferenceValue(String key){
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(context);
Editor editor = sharedPreferences.edit();
editor.remove(key);
editor.commit();
}
}