Modify strings.xml dynamically

by raukodraug » Thu, 22 Apr 2010 00:55:25 GMT


Sponsored Links
 Hi everyone,

I want to implement a "Settings" section in my application, and I want
that when the user selects whatever, one of the strings from
string.xml will change its value according to the user selection.
Is this possible at all? any ideas on how to implement it?

Thanks!
Have a great day

Gabe

--



Modify strings.xml dynamically

by Mark Murphy » Thu, 22 Apr 2010 00:57:05 GMT


 


You cannot modify strings.xml at runtime. That file, like all resources,
is part of your digitally-signed application.

You are welcome to create your own sort of wrapper mechanism, where you
look to see if the user has changed the value and use it instead of the
string resource, but there is nothing really in Android itself that
implements that pattern for you.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training in US: 14-18 June 2010:  http://bignerdranch.com 

--


Sponsored Links


Modify strings.xml dynamically

by ~ TreKing » Thu, 22 Apr 2010 01:40:08 GMT


 On Wed, Apr 21, 2010 at 11:55 AM, raukodraug




There's no reason to even try this - this is what the built-in preference
classes are for.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--



Modify strings.xml dynamically

by raukodraug » Thu, 22 Apr 2010 04:20:10 GMT


 Thank you Mark and TreKing for your responses, both were very useful.
Now I wont try at all to modify them and the preference activity can
do what i need to
Thanks a lot =)

Gabe

--



Other Threads

1. socket weirdness

Has anybody else experienced weirdness working with sockets in
android?

This is going to sound flaky, but I'm coming to believe that android
sockets are buggy.

This is what I experience: I'm reading data out of a DataInputStream,
constructed with socket.getInputStream(), in a separate thread from
the UI.  Most of the time this works just fine, but every once in a
while, after the thread reads a lot of stuff, the reader thread will
next call readByte() on the data input stream, and read a spurious
value.  I have total control of the data being fed to the socket, and
I'm confident it's fine.  The reading thread is still running, the
socket is fine, nothing has been finalized or frozen or paused.  It
happens only at random times, and seems to increase in frequency the
longer the emulator runs.

hmph

Colin
--~--~---------~--~----~------------~-------~--~----~

2. What time is the deadline? Midnight tonight PST?

http://www.anddev.org/posting.php
--~--~---------~--~----~------------~-------~--~----~

3. How to compose a layout with 2 layouts, one with a TextView and a Button and another one with a ListView?

4. LinearLayout touch mode scrolling/focus problem

5. How to set an ImageView from filename

6. What time is the deadline? Midnight tonight PST?

7. Timekeeper