Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private final static String FILE_NAME = "AppSp"; public static float getFloat(Context context, String key, float defVale) { return preferences(context).getFloat(key, defVale); } private static SharedPreferences preferences(Context context) { return context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); } }