I have a string that is HTML encoded and want to decode it and detect phone numbers and URL's to make them clickable after decoding it.
I've found
Html.decode()
to decode the text and this makes links of the hyperlinks. Then if I then call
Linkify.addLinks()
to it then the hyperlinks will then lose their extended paths.
Ex:
will become
If it was already a hyperlink.
How do I HTML decode the string and linkify the string while also keep the extended hyperlink address?
if (Build.VERSION.SDK_INT >= 24)
{
description.setText(Html.fromHtml(opportunity.getDescription() , Html.FROM_HTML_MODE_LEGACY));
}
else
{
description.setText(Html.fromHtml(opportunity.getDescription()));
}
Linkify.addLinks(description, Linkify.ALL);
description.setMovementMethod(LinkMovementMethod.getInstance());