Android examples for Android OS:SharedPreferences
read Integer from SharedPreferences
//package com.book2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String PREF_NAME = "FILTER_PREFERENCES"; public static final int MODE = Context.MODE_PRIVATE; public static int readInteger(Context context, String key, int defValue) { return getPreferences(context).getInt(key, defValue); }//from w w w .j av a 2s.c om public static SharedPreferences getPreferences(Context context) { return context.getSharedPreferences(PREF_NAME, MODE); } }