I have an EditText field called ed. It will store some text that the user will need when the app is started again. I will need to save the text so that when the app is opened again it is back in the EditText field. How do I go about this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SharedPreference is a way to go.
The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).
Here is the example to implement SharedPreferences.
http://android-er.blogspot.com/2011/01/example-of-using-sharedpreferencesedito.html
or
http://marakana.com/forums/android/examples/63.html
or
One more basic thing you can look up is the example implementation given in the APIDemos of android. APIDemos sample application has all basic examples one need to know.