Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static String ReadSharedPreferencesString(Context context, String name, String key, String defaultvalue) { try { SharedPreferences userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE); return userInfo.getString(key, defaultvalue); } catch (NullPointerException e) { e.printStackTrace(); return null; } } }