0

Greetings!

I want to format this HTML into textview:

<p><a href="https://developerfromjokela.com">Attachment</a></p>

I expect <a> element to be like this:

Screenshot with expected result

What I get this instead:

Screenshot with problem

I think problem happens, because:

  • Html class can't get links from element's child

Here is my code:

if (message.getContentHtml().split("<p>").length > 2)
                messageText.setText(HtmlCompat.fromHtml(message.getContentHtml(), HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE));
            else
                messageText.setText(HtmlCompat.fromHtml(message.getContentHtml(), HtmlCompat.FROM_HTML_SEPARATOR_LINE_BREAK_HEADING).toString().trim());

There is this trim because HTML.fromHtml is generating some spaces, and if there is only one row, it can be trimmed to look nice in UI. I tried removing it, but still link is not shown.

Thanks for helping Regards.

DFJ
  • 93
  • 2
  • 9

0 Answers0