1

I am writing a program which asks the user to enter name, age and country and should save the data in a file. The user should be able to delete, edit and view the data.

the output should be like this.

enter image description here

When I save the data it is stored in one text file. For example the user inputted the following. Name: John Wall, Age: 23, Country: Canada then it will save in a text file as "John 23 Country". How can I able to load those data in their specific text box?

Mat
  • 202,337
  • 40
  • 393
  • 406
xknozi
  • 1,335
  • 3
  • 12
  • 20
  • Please used database instead of save data in text file. – Nikhil Oct 19 '12 at 06:38
  • I am required to save it in a text file using File Handling in Android. – xknozi Oct 19 '12 at 06:43
  • whenever you enter edittext fiels it store into sharedprefense and whever get thats value prfer link http://stackoverflow.com/questions/11831287/how-to-persist-data-in-edittext-using-shared-preferences-in-android/11831469#11831469 – QuokMoon Oct 19 '12 at 06:52

1 Answers1

0

You have a couple of options

  1. Write the contents to a database. A tutorial on writing to SQL lite should get your started [1]

  2. If the information is meant for light weight storage (say this is just one entry) use shared preferences / file based persistence [2]

[1] - http://www.vogella.com/articles/AndroidSQLite/article.html

[2] - http://www.vogella.com/articles/AndroidFileBasedPersistence/article.html

Deepak Bala
  • 11,095
  • 2
  • 38
  • 49