• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

resource file strings.xml change data

 
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one question for the resource files of an android app, i can read a value from the file, but is it possible to change that value in the file?
 
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you cant modify the res folders file.
 
Greenhorn
Posts: 13
Android Python C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you are asking whether you can modify the strings stored in the "strings.xml" file in your code like you could manipulate any other string stored as a variable..

The answer to that question is No. Those values are Constants, IE they cannot be modified unless you open the file in eclipse and manually change them.

If you want Strings and String-array's that are modifiable while the program is running, then you will need to create and modify them within the java portion of android.

Pseudo code:


An extremely simple example but you get the point.

If you mean actually opening the "strings.xml" file in eclipse? then yes, it is completely modifiable, its just that you need to use the proper syntax to create the variables.

Pseudo code:


just paste that into strings.xml, just make sure that strings.xml begins with

and ends with


To use a string or string-array defined in this file, or any other file like this, use


If you aren't sure where to put that code, hit "Ctrl + f" on your keyboard, and search for

and paste it into the end of the constructor.

if you don't know what LogCat is, in Eclipse click Window -> Show View -> Other... a window will pop up, maximize the folder "Android" to the left and select "LogCat" and click Ok.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic