0

I am trying now for days to add item (String) into array.xml (string-array) file in values folder. The added item must be stored there, because i want to use this strings in another activity, too.

my array.xml looks like this

<string-array name="Array">
    <item>Example</item>
</string-array>

I have tried it in different ways, but as the last it looks in my MainActivity like this

private void addArray(){
    String [] array = getResources().getStringArray(R.array.Array);
    ArrayList<String> lst = new ArrayList<String>(Arrays.asList(array));
    final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lst);
    adapter.add("Hello");
}

But that did not work either. This don't adds an item to my array.xml file.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
  • 4
    asked bazillion times, resoures are read only – Selvin Jan 24 '17 at 01:06
  • Yes, I know, but I read all bazillion posts. And found this solution, but this dont works. –  Jan 24 '17 at 19:09
  • Lol, it is not a solution for adding to `array.xml` resource... because you can't do this at all ... what do you not understand in **READ ONLY** ? – Selvin Jan 24 '17 at 19:10

0 Answers0