Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String APP = "app"; private static SharedPreferences sp; public static void putString(Context context, String key, String value) { if (sp == null) { sp = context.getSharedPreferences(APP, Context.MODE_PRIVATE); } sp.edit().putString(key, value).apply(); } }