Oli
Oli

Reputation: 1019

Android - EditText to StringArray stored in xml

Ive been attempting to work out how to take the text from an edittext box and move it into a string array located in strings.xml.

Basically its a user form which the user fills in, onClick it adds the information to the database and is then viewable in a listview. The listview and everything works fine but i cant work out to put in information using edittext boxes.

Any hints or techniques would be very much appreciated.

Thanks

Upvotes: 0

Views: 915

Answers (3)

samir
samir

Reputation: 339

No way. You can't do such a thing. Surely not with strings.xml and androidmanifest.xml too.

The other option you have is: if you already have some values in strings.xml, you can fetch them in an list and append your own values that you want from user. After that, put it in an adapter and display it in a list view like you usually do.

Upvotes: 0

Cheryl Simon
Cheryl Simon

Reputation: 46844

You want to take user input for an edit text, and put it in strings.xml? You can't do that. String resources are for static strings, not things that will change at runtime. You should look at other data storage options, like shared preferences. See data storage.

Upvotes: 3

Blumer
Blumer

Reputation: 5035

I could be wrong (someone please correct me if I am), but I don't believe strings.xml is editable at runtime. Rather, it's a set of predefined resources that your app has access to, and it cannot be modified by the program--only read.

If you're looking to make this information available to your app for subsequent uses, you should look at using SharedPreferences: http://developer.android.com/guide/topics/data/data-storage.html#pref

Upvotes: 2

Related Questions