Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String SP_NAME = "login_data"; public static void setLatitude(Context context, String latitude) { SharedPreferences sp = getSP(context); SharedPreferences.Editor editor = sp.edit(); editor.putString("latitude", latitude); editor.apply(); } private static SharedPreferences getSP(Context context) { return context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); } }