0

i have a sting array containing these elements

<string-array name="actions">
        <item>Item 1</item>
        <item>Item 2</item>
        <item>Item 3</item>
    </string-array>

i want to access to this string array "actions" and modify programmatically in it i mean like removing and adding items but in java not in xml .is there any solution to do that ?

Thanks :)

Fg.Salim
  • 49
  • 7

2 Answers2

0

You cannot programmatically modify the resources.

What you can do is to create a separate list of strings and initially copy the strings from the resources into it. You can then modify the list as you wish.

Szymon
  • 42,577
  • 16
  • 96
  • 114
0

Resource files are constants you can't change them in the run time , but there are some alternatives you can do , take look on it :

How do I generate XML resources at runtime on Android?

Is it possible to change the value of a string added in res/strings.xml on Android at run time/ or by code?

Community
  • 1
  • 1
mohammed momn
  • 3,230
  • 1
  • 20
  • 16