Here you can find the source of saveSetting(Context context, String name, String value)
public static void saveSetting(Context context, String name, String value)
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String PREFERENCES = "VeganFriendlyPrefs"; public static void saveSetting(Context context, String name, String value) {//from w w w .j av a 2 s. com SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE); prefs.edit().putString(name, value).apply(); } public static void saveSetting(Context context, String name, Long value) { SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE); prefs.edit().putLong(name, value).apply(); } }