Search this blog

How to edit android String Resource

If you inspect the main.xml layout file of the project, you will notice that it displays
a simple layout with a single TextView control. This user interface control simply
displays a string. In this case, the string displayed is defined in the string resource
called @string/hello.
To edit the string resource called @string/hello, using the string resource editor,
follow these steps:
1. Open the strings.xml file in the resource editor.
2. Select the String called hello and note the name (hello) and value (Hello
World, DroidActivity!) shown in the resource editor.
3. Within the Value field, change the text to Hello, Dave.
4. Save the file.
If you switch to the strings.xml tab and look through the raw XML, you will notice
that two string elements are defined within a <resources> block:
<?xml version=”1.0” encoding=”utf-8”?>
<string name=”hello”>Hello, Dave</string>
<string name=”app_name”>Droid #1</string>
The first is the string @string/hello. The second is @string/app_name, which contains
the name label for the application. If you look at the Android manifest file
again, you will see @string/app_name used in the application configuration.


Post a Comment