What is the correct way to store a variable so it retains this value when activities change?

view full story

http://stackoverflow.com – I am going crazy trying to figure out how to store a variable someplace so when I switch to another activity then back again the variable still contains this value. I did this a while ago using shared preferences, but this was a bad solution, this was way more permanent than I needed and just not the correct way. If a certain button is pressed in activity one, this opens activity two via an intent and sets a value to a string in activity two. When going to another activity, or pressing the back button, then returning to activity two, the string is reset back to its initial value. I have tri (HowTos)