0

How to save encoded value of html to string help me I'm saving html in string htmldescription but is encoded into show actual html see my this post html code change when get in json and save in string

Html code wil change when I save in textview with this command is show perfectly

mytext= (Html.fromHtml(htmldescription));

But I want to save in string what will i do? How to save encoded html(string) in string any idea???

String  htmldescription = school2.getJSONObject(0).getString("description");
mytext= (Html.fromHtml(htmldescription));
String coverthtml= mytext?????????????

2 Answers 2

1

This is the original html value:

String  htmldescription = school2.getJSONObject(0).getString("description");

And this is the html formatted value:

Spanned spanned = Html.fromHtml(formattedText);

And this is the String conversion:

String formattedText = spanned.toString();
Sign up to request clarification or add additional context in comments.

Comments

0

Use Spanned first

Spanned mytext = Html.fromHtml(htmldescription);

now convert the spanned to string

String url=mytext.toString();

To know more details about spanned refer this url

Android Spanned, SpannedString, Spannable, SpannableString and CharSequence

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.