Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { /** * Gets the localization method from the shared preferences. * * @param context The calling context. * @return int value, default 1 {@link com.indoor.navigation.indoornavigation.R.array#pref_loc_entries}. */ public static int getPrefPositioningMethod(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return Integer.valueOf(sharedPreferences.getString("localization_type", "0")); } }