Android examples for Android OS:SharedPreferences
read Boolean 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 boolean readBoolean(Context context, String key, boolean defValue) { return getPreferences(context).getBoolean(key, defValue); }//w w w. j a va2 s.co m public static SharedPreferences getPreferences(Context context) { return context.getSharedPreferences(PREF_NAME, MODE); } }