TIP: It is not trivial to figure out how to show HTML formatted text in a TextView. First, escape the tags <b>Title</b> in the text as in:
<string name="about_tlh_header"><b>Title</b></string>
Then format the text and convert the HTML text to styled text as in:
textViewHeader.setText(Html.fromHtml(String.format(inBundle.getString("qprinstitute.crisis.Display.Header"))));
Your app can support both formatted and non-formatted text by setting a flag such as isFormatted:
Intent i= getIntent();
if (i != null) {inBundle= i.getExtras();}
if (inBundle != null) {
isFormatted= inBundle.getBoolean("qprinstitute.crisis.Display.IsFormatted",false);
if (isFormatted){ textViewHeader.setText(Html.fromHtml(String.format(inBundle.getString("qprinstitute.crisis.Display.Header")))); textViewBody.setText(Html.fromHtml(String.format(inBundle.getString("qprinstitute.crisis.Display.Body"))));
textViewFooter.setText(Html.fromHtml(String.format(inBundle.getString("qprinstitute.crisis.Display.Footer"))));
}
else {
textViewHeader.setText(inBundle.getString("qprinstitute.crisis.Display.Header"));
textViewBody.setText(inBundle.getString("qprinstitute.crisis.Display.Body"));
textViewFooter.setText(inBundle.getString("qprinstitute.crisis.Display.Footer"));
}
} // setText accepts null
String.format is not an "efficient" call so we try to avoid calling String.format if the text is not formatted.
Note: <string formatted="false" name="about'> still appears to permit escaping html tags, but may not permit dynamic substitution as in:
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>
JAL