Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { private static String HORSEPUSH = "HorsePush"; public static String getExtraData(Context context) { return getSharedPreferences(context, HORSEPUSH + "extradata"); } public static String getSharedPreferences(Context context, String key) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return sharedPreferences.getString(HORSEPUSH + key, ""); } }