简体   繁体   中英

how to show html.fromhtml text in recyclerview from database android

I am able to save and retrieve the rich text (bold, italic, color) to and from the database into the editor. But when I try to show the rich text in the recyclerview, it shows me only plain text and not the styled text (color, bold etc). How can I do this? Thanks

Showing text in the recyclerview

String texto_sin_html = Html.fromHtml(list.get(position).getTexto()).toString();
    holder.texto.setText(texto_sin_html);

saving text to database

String almostSameText = Html.toHtml(texto.getEditableText()).toString();
                    base.modificarNota(titulo.getText().toString().trim(), almostSameText, id);
                    getActivity().onBackPressed();

It should be;

holder.texto.setText(Html.fromHtml(list.get(position).getTexto())); 

without the toString()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM