In fact Html.fromHtml (String source) > is now considered obsolete. This, however, does not imply that it can not be used. Because you have no other option, if you want the app to run in versions prior to N.
The method that replaces it is Html.fromHtml (String source, int flag) (1) .
The parameter flag
must be passed one or more (separated by the operator or |
) of constants that class Html states.
Each of these flags indicates how html in source
should be "interpreted" when constructing Spanned returned by the function.
For example, the constant FROM_HTML_SEPARATOR_LINE_BREAK_LIST
indicates that text within <ul>
elements will be by default separated from other texts by a newline .
(1) - Use the Html constant. FROM_HTML_MODE_LEGACY for pre-N behavior.