// load file
SharedPreferences sharedPref = getSharedPreferences(PREFERENCES_FILENAME, MODE_PRIVATE);
// read value
String value = sharedPref.getString(PREFERENCE_KEY, null);
// write value
sharedPref.edit()
.putString(PREFERENCE_KEY, value)
.apply();
SharedPreferences sharedPref = getSharedPreferences("name", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString("key", "Value");
editor.commit();