Android SharedPreferences Save putPrefInt(Context c, String key, int value)

Here you can find the source of putPrefInt(Context c, String key, int value)

Description

put Pref Int

Declaration

public static void putPrefInt(Context c, String key, int value) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Main {
    public static void putPrefInt(Context c, String key, int value) {
        SharedPreferences sp = PreferenceManager
                .getDefaultSharedPreferences(c);
        sp.edit().putInt(key, value).commit();
    }// w w  w .  j  a  v  a  2  s  .c  o  m
}

Related

  1. saveSetting(Context context, String name, Long value)
  2. saveSetting(Context context, String name, String value)
  3. updatePrefValueByModel(SharedPreferences pref, String key, String thisModel, String targetModel, Object targetModelValue, Object notTargetModelValue)
  4. setSharedPreferences(String key, String value, Context context)
  5. putPrefBoolean(Context c, String key, boolean value)