Android SharedPreferences Save saveSetting(Context context, String name, Long value)

Here you can find the source of saveSetting(Context context, String name, Long value)

Description

save Setting

License

Open Source License

Declaration

public static void saveSetting(Context context, String name, Long value) 

Method Source Code

//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) {//w w  w . j av a  2s  .  c  om
        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();
    }
}

Related

  1. putPrefs(Activity context, int mode, Map pairs)
  2. putSharedPrefs(Context context, String prefName, int mode, Map pairs)
  3. saveSetting(Context context, String name, String value)
  4. updatePrefValueByModel(SharedPreferences pref, String key, String thisModel, String targetModel, Object targetModelValue, Object notTargetModelValue)
  5. setSharedPreferences(String key, String value, Context context)
  6. putPrefBoolean(Context c, String key, boolean value)