I want to create an application in which the user have two edittexts. Whenever the user types in the edittexts, I want to store it and retrieve when the user wants it. Also the user should be able to store as many files which contains his data as possible. How to do that in android?
-
post some code, wich causes the problem with – Mykola Oct 21 '15 at 15:39
3 Answers
Just get the text from your EditText:
yourEditText.getText().toString()
Then use SharedPreferences to save and retrieve the data as needed

- 7,631
- 9
- 51
- 81
There are a few options you have when it comes to storing data in Android.
The most simple way would be storing values in SharedPreferences
, but I wouldn't advise trying this because
the user should be able to store as many files which contains his data as possible
So, you've got a couple other options
1. Saving Files
You could save one or more files to the users phone, and read it back in when the user wants to retrieve it.
2. Saving Data in SQL Databases
You could use a SQLite Database to manage the data in a more structured way.
Saving data to a database is ideal for repeating or structured data, such as contact information.
In your case, it really depends on what you are planning to do with this app. If you feel that you may expand the information the user can save, I would say go with a database. If you are sure that you will only need the info from the two EditTexts
I think writing to files would suffice.

- 1
- 1

- 12,073
- 8
- 39
- 55
Depending on your use case you have basically three choices in Android to store data:
- Shared preferences
- Create a file in the file system
- Use a database
Further information about each option can be found here: http://developer.android.com/training/basics/data-storage/index.html

- 3,645
- 1
- 28
- 33