-1

To get a string from the resourses in android using java i use

  Resources res=this.getResources();
    String ch=res.getString(R.string.naeme);

but now i want to add a string to strings.xml using java code , how to do that ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Akrem Hammami
  • 123
  • 12
  • You can't really change the values in resources programmatically, can you describe what are you trying to achieve so that I can help – Parag Pawar Sep 05 '18 at 19:25

1 Answers1

5

strings.xml is a constants file and it can't be modified at run time. Hence you can't write any string to strings.xml file

Use shared preference to store any string if needed

Viswanath Kumar Sandu
  • 2,230
  • 2
  • 17
  • 34