1

All,

I have the following in my string resource xml file.

<?xml version="1.0" encoding="utf-8"?> <resources>

<string name="hello">Hello World, ProDroid_Android!</string>
<string name="app_name">ProDroid_Android-CH3-Resources</string>

<plurals name ="eggs_in_A_basket">
    <item quantity ="one"> There is 1 egg</item>
    <item quantity = "other"> There are %d eggs</item>

</plurals>
<string name="simple_string">simple string</string>
<string name="quoted_string">"Quoted String 'xyz' string"</string>
<string name="double_quoted_string">\"Double Quoted String\""\";</string>
<string name="java_format_string">Hello %2$s Java format String. %1$s again.</string>

<string name="tagged_string">Hello <b><i> Slanted Android.</i></b>, You are bold</string>

When I go to put the tagged_string into a TextView with the HTML formatting it does not display with it's formatting. However, if I cut and paste the Hello Slanted Android., You are bold and manually put it into .setText it works, or if I set it statically in my layout xml file. However using the Java code below it does not work (All you see is unformatted text):

//HTML
        TextView t6 = (TextView) findViewById(R.id.textView6);

        t6.setText(Html.fromHtml(ProDroid_Android.this.getString(R.string.tagged_string)));

Any help would be appreciated.

Thx

ControlAltDelete
  • 3,576
  • 5
  • 32
  • 50

1 Answers1

1

If you format your text in XML it isn't necessary to use Html.formatHtml(...)

Try this:

t6.setText(getString(R.string.tagged_string);

EDIT: Hmm... This way worked for me fine and I tried exactly your String. Maybe your Project needs a clean (Project > Clean ...)

If this doesn't help: I found another question. Maybe the answer there can solve your problem

Community
  • 1
  • 1
dudeldidadum
  • 1,281
  • 17
  • 27