Skip to content Skip to sidebar Skip to footer

How To Save Encoded Html In String

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 jso

Solution 1:

This is the original html value:

Stringhtmldescription= school2.getJSONObject(0).getString("description");

And this is the html formatted value:

Spannedspanned= Html.fromHtml(formattedText);

And this is the String conversion:

StringformattedText= spanned.toString();

Solution 2:

Use Spanned first

Spannedmytext= 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

Post a Comment for "How To Save Encoded Html In String"