So, I've been developing an app for a school project. Basically what it does is the user logs in using Instagram API. His token is saved in Shared Preferences so the user doesn't need to log in everytime he enters the app. The user full Instagram name is saved in Shared Preferences too once the user logs in the first time:
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = prefs.edit();
editor.putString("full_name", Global.full_name);
editor.commit();
This is the code for saving the full_name in LoginActivity. I have debugged this part of the code and Shared Preferences in saving correctly all the data. The problem is when the user is already logged in (he logs in, closes the app and opens it again) and goes to the ProfileActivity a label which should get SharedPreferences full_name variable doesn't get it. Where is the code for retrieving the data:
SharedPreferences editor = PreferenceManager.getDefaultSharedPreferences(ProfileActivity.this);
String full_name = editor.getString("full_name",null);
txtNomeUtilizador.setText(full_name);
Is there any problem when I'm retrieving the data from Shared Preferences? Because when I debug it says that there is no "full_name" variable in Shared Preferences