开发者

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 i开发者_Python百科n 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


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜