Here you can find the source of setSharedPreferences(String key, String value, Context context)
public static void setSharedPreferences(String key, String value, Context context)
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { public static void setSharedPreferences(String key, String value, Context context) {/* ww w . j a v a 2s . c o m*/ SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(context); SharedPreferences.Editor editor = prefs.edit(); editor.putString(key, value); editor.commit(); } }