Print HTML Tables, <tr>, <td> and <a> tags on Textview Android

Viewed 54

I have a chat app that receives HTML as JSON through an API. Each chat message displays the HTML in a TextView, however I need to display Tables, and tags. I have tried with Html.fromHtml() function and an ImageGetter for the images, however I can't find the way to display the Table tags.

I cannot use a WebView because that would imply displaying a webview for every message (which isn't very efficient).

Thanks in advance.

1 Answers

fromHtml() does not support <table> and related tags. Your choices are:

  1. Use WebView to render your HTML table (but as you said you don't want to do that)
  2. Convert your table to text by using whitespaces or padding.
  3. Natively use TableLayout in your Android app.
Related