Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; public class Main { public static boolean setPrefDouble(Context context, String fileName, String key, double value) { return setPrefString(context, fileName, key, value + ""); } public static boolean setPrefString(Context context, String fileName, String key, String value) { Editor editor = getPref(context, fileName).edit(); editor.putString(key, value); return editor.commit(); } public static SharedPreferences getPref(Context context, String fileName) { return context.getSharedPreferences(fileName, Context.MODE_PRIVATE); } }