I have a class to save the email and user that connect in the application with sharedpreferences
, but I save the data without any key
reference so when I want to save a different data without overwriting the previous one I do not it does, I guess I need to assign some key
to reference it and be able to save the data I want without stepping on the previous one and giving it a name:
public void save(Context context, String text) {
SharedPreferences settings;
Editor editor;
settings = PreferenceManager.getDefaultSharedPreferences(context);
editor = settings.edit();
editor.putString(PREFS_KEY, text);
editor.commit();
}
Here I call the function:
String email = _emailText.getText().toString();
sharedPreference.save(this, email);