If you want to use Shared Preferences instead of sending the data through bundles, use this code:
String stringToSave = "Save me!";
// To save data to SP
SharedPreferences.Editor editor = getContext().getSharedPreferences(SHARED_NAME_STRING, MODE_PRIVATE).edit();
editor.putString(USER_NAME_STRING, stringToSave);
editor.apply();
// To load the data at a later time
SharedPreferences prefs = getContext().getSharedPreferences(SHARED_NAME_STRING, MODE_PRIVATE);
String loadedString = prefs.getString(USER_NAME_STRING, null);
This code is setup to work with fragments. If you use an Activity instead, remove getContext() in front of getSharedPreferences().