how use sharedpreferences in android code example
Example 1: android sharedpreferences
SharedPreferences sharedPref = getSharedPreferences(PREFERENCES_FILENAME, MODE_PRIVATE);
String value = sharedPref.getString(PREFERENCE_KEY, null);
sharedPref.edit()
.putString(PREFERENCE_KEY, value)
.apply();
Example 2: android sharedpreferences
SharedPreferences sharedPref = getSharedPreferences("name", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString("key", "Value");
editor.commit();