开发者

Write data in String.xml Android

开发者 https://www.devze.com 2023-02-15 17:49 出处:网络
I want to write some values from editText of activity in the file string.xml. I will explain with an example:

I want to write some values from editText of activity in the file string.xml. I will explain with an example:

In the activity I have 2 editText and 1 button to submit the information. Imagine that the editText are for inser开发者_如何学Pythonting NAME and SURNAME. I have the following code in string.xml

<string name="person_name"></string>
<string name="person_surname"></string>

At the begining, those fields will be empty but after submiting the info, I want to write the values obtained from the editTexts in that file.

Any suggestion?

Thanks in advance


That's not possible. Strings.xml is only for storing predefined strings. Use SharedPreferences to store this data.


Although what you want is not possible but can be done through SharedPreferences http://developer.android.com/guide/topics/data/data-storage.html#pref

0

精彩评论

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