Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { private static SharedPreferences pref = null; private static SharedPreferences.Editor editor = null; public static void savePrefFloat(Context context, String key, float value) { if (pref == null) { pref = PreferenceManager.getDefaultSharedPreferences(context); } if (editor == null) { editor = pref.edit(); } editor.putFloat(key, value); editor.commit(); } }