Android Tutorial

(avery) #1
Android Tutorial 133

views and for help text. The application name is also stored as a
string resource, by default.


String resources are defined in XML under the /res/values project
directory and compiled into the application package at build time.
All strings with apostrophes or single straight quotes need to be
escaped or wrapped in double straight quotes. Some examples of
well-formatted string values are shown in Table.


String Resource Formatting Examples


You can edit the strings.xml file using the Resources tab, or you
can edit the XML directly by clicking the file and choosing the
strings.xml tab. After you save the file, the resources are
automatically added to your R.java class file.


String values are appropriately tagged with the tag and
represent a namevalue pair. The name attribute is how you refer to
the specific string programmatically, so name these resources
wisely.

Free download pdf