So basically what I want to do is to save strings for selected choices and some entered text in edit texts (to remember age that kind of things that don’t change easily/fast) so when the user restarts the application he doesn’t need to enter all that information again.
But I’ve been looking all over the internet about saving strings in shared preferences or internal memory and I can’t understand lots of things and I can’t get it to work.
So my question is can someone please provide me sample code for 1 radio group or 1 editText (it’s enough) how to remember the selected choice in string or the entered value so the next time when the app is started that string is called the choice/text is set automatically.
This is from a previous answer of mine, but it will work for you.
Call
savePreferences()inonPause()if you want to save all changes by default or in an OnClickListener if it suits you better. You should callrestorePreferences()in a method likeonCreate()to load these values as the app starts.