Saving to SharedPreferences

public static void saveIntPreference(Context context, String key, int value) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor = prefs.edit();
    editor.putInt(key, value);
    editor.commit();
}

public static void saveStringPreference(Context context, String key, String value) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor = prefs.edit();
    editor.putString(key, value);
    editor.commit();
}
  
public static void saveBooleanPreference(Context context, String key, boolean value) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    Editor editor = prefs.edit();
    editor.putBoolean(key, value);
    editor.commit();
}