写在String.xml Android的数据写在、数据、xml、String

2023-09-05 04:36:02 作者:人心太拥挤

我想要写在文件string.xml从活动EDITTEXT一些值。 我会用一个例子说明:

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

在活动我有2 EDITTEXT和1个按钮提交信息。试想一下,在EDITTEXT是插入姓名。 我有以下的code在string.xml

In the activity I have 2 editText and 1 button to submit the information. Imagine that the editText are for inserting NAME and SURNAME. I have the following code in string.xml

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

在开始时,这些领域将是空的,但submiting的信息后,我想写从该文件中的editTexts获得的值。

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.

任何建议?

在此先感谢

推荐答案

虽然你想要的东西是不可能的,但可以通过共享preferences来完成的 http://developer.android.com/guide/topics/data/data-storage.html#$p$pf

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