Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static SharedPreferences sharedPreferences; private static String CONFIG = "config"; public static void saveStringData(Context context, String key, String value) { if (sharedPreferences == null) { sharedPreferences = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); } sharedPreferences.edit().putString(key, value).commit(); } }