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. Android 2.2 Voice Recognition Sample problem And Speech Recognition with file

Hello,
I'm using android emulator (SDK 2.2) with Eclipse and I tried to do
work the sample VoiceRecognition.java but it returns to me this
message "Recognizer not present". What's the matter? I read on
different forums "a problem with the initial system image", should I
upgrade system image or there is nothing to do with this?

I have another problem, I would like to use an wav or mp3 like input
of my speech recognizer (instead of audio record with microphone), how
to do this? is it possible or not?


Thank you.



-- 

2. insert musical unicode

I try to use the setTypeface to display musical unicode symbols, but
it doesn't work. Here is my code. Any workaround?

              .java file
         @Override
            public void onCreate(Bundle icicle) {
                super.onCreate(icicle);
                setContentView(R.layout.notes);

                    TextView tv=(TextView)findViewById(R.id.minim);
                    Typeface face=Typeface.createFromAsset(getAssets(),
                                                          "fonts/musica.otf");

                    tv.setTypeface(face);
         }

              ,xml file
        <Button android:id="@+id/minim"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=" <i copy paste the note from word.doc, but is only
show up square" >
                </Button>

-- 

3. CodeSnipr Learning can be simple!!

4. New to Android and programming

5. Query regarding MMS in android emulator

6. Maps API - controlling size of streets, font?

7. Parcelable and Inheritance