I want the way or the code e.g. to store the value of EditText in the temp variable so when I redirect the activity at that time it stores the value in the temporary variable. When I move back to the activity I can store back it to the EditText.
Asked
Active
Viewed 2,516 times
3 Answers
0
Please check this thread you want the same thing. How to configure application settings in android?
0
SharedPreferences
may be the easiest way in your case. This is designed for storing a relatively-small amount of data (ballpark practical maximum around 50-100 values) in classic key/value format.
http://androidandandroid.wordpress.com/2010/07/25/android-tutorial-16/
http://developer.android.com/reference/android/content/SharedPreferences.html

Jim Blackler
- 22,946
- 12
- 85
- 101
0
You could use SharedPreferences.
import android.content.SharedPreferences;
...
private SharedPreferences mPrefs;
private static final String MY_TEXT_BOX_STRING_KEY = "prefs_textbox_key"
...
mPrefs = getSharedPreferences("myAppPrefs",0);
...
// Get the string:
myTextBoxString = prefsGetString(MY_TEXT_BOX_STRING_KEY);
// Set the string:
prefsSetString(MY_TEXT_BOX_STRING_KEY, "blahblah");

Trevor
- 10,903
- 5
- 61
- 84