The answer to this question works perfectly for my text... the first time. I have some resource file-defined strings:
<string name="permission_replace">PERMISSION</string>
<string name="warn_permission">This app needs PERMISSION to work properly. Update in <u>settings</u>.</string>
The <u>
tags work properly the first time I display the text, but when I go to replace my placeholder ("PERMISSION"
) the underline gets lost. Here's how I'm doing the replacement:
warnPermissionText.setText(warnPermissionText.getText().toString().replaceAll(getString(R.string.permission_replace),"some permission text"));
How can I retain the underline tags through the replacement? Or do I just have to programmatically add them back in? I'm not sure what magic does the formatting on the first go 'round.