Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static void putString(Context context, String key, String value) { SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putString(key, value); editor.apply(); } }