How to Change the value of R.string programmatically?
nameEditText = (EditText) findViewById(R.id.name);
name = nameEditText.getText().toString();
string.xml
<string name="name">name</string>
I had declared a string in my strings.xml
file.
public class MainActivity extends AppCompatActivity {
private String name;
private EditText nameEditText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
nameEditText = (EditText) findViewById(R.id.name);
name = nameEditText.getText().toString();
}
...
I want to get the edittext value and set to <string name="name">name</string>
.
This code get the text from Edittext.
nameEditText = (EditText) findViewById(R.id.name);
name = nameEditText.getText().toString();
I want to change the value of <string name = "name"> name </string>
to the value of the string name.
How can I do this?