You should be using SharedPrefences
. They are quite simple to use and will store the variables in the application data. As long as the user never hits "Clear Data" in the settings for your application, they will always be there.
Here is a code sample.
To access variables:
SharedPreferences mPrefs = getSharedPreferences("label", 0);
String mString = mPrefs.getString("tag", "default_value_if_variable_not_found");
To edit the variables and commit (store) them:
SharedPreferences.Editor mEditor = mPrefs.edit();
mEditor.putString("tag", value_of_variable).commit();
Make sure both "tag" fields match!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…