Issue
In my app, I want to display a string in a text view with html markup. this will get the string:
String mystring = getResources().getString(R.string.Terms_And_Conditions);
except won't allow html characters. I can see on forums to use getText() instead but it doesn't work
mystring = getResources().getText(R.string.Terms_And_Conditions);
I get the error
error: incompatible types: CharSequence cannot be converted to String
In all the examples of using html in a text view, they just had a simple hard coded string, and that works fine. But pulling the string from the resources, it just eats all the html, like the html tags aren't their, but also it didn't actually do the markup. Everyone says I need to use getText() instead. So how can I use getText() to get a string resource or how can I display the html in my string resource? Or do I just have to hard code the string directly in Java?
Thank you in advance.
Solution
If you want to use getText() you have to proceed like this:
String mystring = activity.getResources().getText(R.string.Terms_And_Conditions).toString()
Answered By - Mbula Mboma Jean gilbert
Answer Checked By - Willingham (JavaFixing Volunteer)