XML encodings wonapost work either

Source file format: XML file requiring a <?xml version="1.0" encoding="utf-8"?> declaration, and a root <resources> element containing one or more <string> tags.

Resource source file location: res/values/strings .xml (File name is arbitrary.)

Compiled resource datatype: Resource pointer to a Java CharSequence. Resource reference name:

• XML: @[package :]string/some name (where some_name is the name of a specific string) Syntax

Value is a string, with optional styling tags. Has only one attribute:

• name - The name used in referring to this string.

Example XML Declaration

The following declares two strings: the first — simple text with no formatting (resulting in a CharSequence that is simply a String object) — the second includes formatting information in the string (resulting in a CharSequence that is a complex data structure). If you are using the custom editor for string files in Eclipse, the HTML formatting tags will automatically be escaped and you will need to use Context.getStringQ and fromHtml(String) to retreive the resource and then convert it to formatted text.

<resources>

<string name="simple

welcome

message">Welcome!</string>

<string name="styled

welcome

message">We are <b><i>so</i></b> glad to see

you.</string>

</resources>

Example Java code

0 0

Post a comment