I used the layout resource editor to modify the main.xml layout file to add a second TextView control to my app. by default, its set to something like @+id/TextView01. How do I Set the text attribute of the TextView control to my newly created String resource? I tried going into main.xml and just editing the android:text to point to the name of my new string, but it didn't seem to work.
A:
you define your strings inside resources/strings/values.xml and you can reference them using "@string/name_of_string" syntax in your layouts.
android:text="@string/name_of_string"
madsleejensen
2010-10-18 13:55:14
Thanks a lot for your help. That's what I tried doing. I added <string name="rules">Random text bla bla</string> to strings.xml and then added <TextView android:text="@string/rules" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> Did I make some basic mistake?
LuxuryMode
2010-10-18 14:23:58
Got it, thanks!
LuxuryMode
2010-10-18 14:29:28
just a note: don't forget to mark an answer as accepted if it solved your problem...
Sotapanna
2010-10-18 15:09:12
@the sotapanna dont see your username on any answer
LuxuryMode
2010-10-20 01:19:59
@LuxuryMode: it's about accepting the answer, not about seeing a name somewhere. http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work Nevermind, I just wanted to point out...
Sotapanna
2010-10-20 06:29:39
@LuxuryMode, theres a arrow on my answer you can click, to accept the answer i given.
madsleejensen
2010-10-20 07:41:35
I knew how to accept an answer, but you confused me by signing in and commenting as two, separate users. :-)
LuxuryMode
2010-10-20 15:18:55
Im not "The Sotapanna" if thats what your thinking :)
madsleejensen
2010-10-20 15:42:38