I read about SharedPreferences but did not understand where i need to put the saving data and where to put the get objects. In my app i get the full name when i open it in the first time by dialog. I need to save the full name for ever (until the user will delete the app or something).
Where and what should i write to save the data(in onDestroy)? Like :
// Create object of SharedPreferences.
SharedPreferences sharedPref= getSharedPreferences("mypref", 0);
//now get Editor
SharedPreferences.Editor editor= sharedPref.edit();
//put your value
editor.putString("name", strName);
editor.commit();
SharedPreferences sharedPref= getSharedPreferences("mypref", 0);
String name = sharedPref.getString("name", "");
And where and what should i write to get the data(in onCreate)?