Can I have Eclipse adding my string resources as I code or do I have to switch to string.xml all the time and add each string?
android:text="@string/hello" />String string = getString (R. string. hello);
Add \t for tab and \n for new line.
The purpose of strings. xml (and other *. xml resource files) is to regroup similar values in one place. This facilitates finding values that would be otherwise buried in the code.
Eclipse will sort of do it for you. So if you have a field:
android:text="hello"
Select "hello" and then goto Refactor-->Android-->Extract Android String, Eclipse will change the line to:
android:text="@string/hello"
and automagically add the line to strings.xml as:
<string name="hello">Hello</string>
JAL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With