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>

0 0

Post a comment